mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Minor Simplification of threading demo
This commit is contained in:
+4
-7
@@ -17,14 +17,10 @@ prefix_table := [...]string{
|
|||||||
};
|
};
|
||||||
|
|
||||||
worker_proc :: proc(t: ^thread.Thread) -> int {
|
worker_proc :: proc(t: ^thread.Thread) -> int {
|
||||||
do_work :: proc(iteration: int, index: int) {
|
|
||||||
fmt.printf("`%s`: iteration %d\n", prefix_table[index], iteration);
|
|
||||||
win32.sleep(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for iteration in 1...5 {
|
for iteration in 1...5 {
|
||||||
fmt.printf("Thread %d is on iteration %d\n", t.user_index, iteration);
|
fmt.printf("Th/read %d is on iteration %d\n", t.user_index, iteration);
|
||||||
do_work(iteration, t.user_index);
|
fmt.printf("`%s`: iteration %d\n", prefix_table[t.user_index], iteration);
|
||||||
|
win32.sleep(1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -56,3 +52,4 @@ main :: proc() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -231,6 +231,7 @@ void check_const_decl(Checker *c, Entity *e, AstNode *type_expr, AstNode *init,
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
// NOTE(bill): Check to see if the expression it to be aliases
|
// NOTE(bill): Check to see if the expression it to be aliases
|
||||||
|
#if 1
|
||||||
case Addressing_Builtin:
|
case Addressing_Builtin:
|
||||||
if (e->type != nullptr) {
|
if (e->type != nullptr) {
|
||||||
error(type_expr, "A constant alias of a built-in procedure may not have a type initializer");
|
error(type_expr, "A constant alias of a built-in procedure may not have a type initializer");
|
||||||
@@ -245,8 +246,9 @@ void check_const_decl(Checker *c, Entity *e, AstNode *type_expr, AstNode *init,
|
|||||||
e->Alias.base = operand.overload_entities[0];
|
e->Alias.base = operand.overload_entities[0];
|
||||||
e->type = t_invalid;
|
e->type = t_invalid;
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#if 1
|
||||||
if (entity != nullptr) {
|
if (entity != nullptr) {
|
||||||
switch (entity->kind) {
|
switch (entity->kind) {
|
||||||
case Entity_Alias:
|
case Entity_Alias:
|
||||||
@@ -276,6 +278,7 @@ void check_const_decl(Checker *c, Entity *e, AstNode *type_expr, AstNode *init,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (init != nullptr) {
|
if (init != nullptr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user