fix(examples): Task_Join -> Task_Wait to match stdlib API

This commit is contained in:
2026-06-11 09:21:06 +03:00
parent a619247f06
commit 224542df7f
3 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
import Std::Io::{PrintLine, PrintInt}; import Std::Io::{PrintLine, PrintInt};
import Std::Task::{Task_Join, TaskHandle}; import Std::Task::{Task_Wait, TaskHandle};
import Std::Channel::{Channel, Channel_New, Channel_SendInt, Channel_RecvInt, Channel_Close}; import Std::Channel::{Channel, Channel_New, Channel_SendInt, Channel_RecvInt, Channel_Close};
func Producer(chPtr: *Channel<int>) { func Producer(chPtr: *Channel<int>) {
@@ -31,7 +31,7 @@ func Main() -> int {
let ch: Channel<int> = Channel_New<int>(3); let ch: Channel<int> = Channel_New<int>(3);
let p: *void = spawn Producer(&ch); let p: *void = spawn Producer(&ch);
let c: *void = spawn Consumer(&ch); let c: *void = spawn Consumer(&ch);
Task_Join(TaskHandle { handle: p }); Task_Wait(TaskHandle { handle: p });
Task_Join(TaskHandle { handle: c }); Task_Wait(TaskHandle { handle: c });
return 0; return 0;
} }
+2 -2
View File
@@ -1,6 +1,6 @@
import Std::Io::{PrintLine, PrintInt}; import Std::Io::{PrintLine, PrintInt};
import Std::Task::TaskHandle; import Std::Task::TaskHandle;
import Std::Task::Task_Join; import Std::Task::Task_Wait;
import Std::Channel::Channel; import Std::Channel::Channel;
func Worker(arg: *void) -> *void { func Worker(arg: *void) -> *void {
@@ -10,7 +10,7 @@ func Worker(arg: *void) -> *void {
func Main() -> int { func Main() -> int {
let handle: *void = spawn Worker(); let handle: *void = spawn Worker();
Task_Join(TaskHandle { handle: handle }); Task_Wait(TaskHandle { handle: handle });
PrintLine("Thread finished"); PrintLine("Thread finished");
return 0; return 0;
} }
+3 -3
View File
@@ -1,5 +1,5 @@
import Std::Io::{PrintLine, PrintInt}; import Std::Io::{PrintLine, PrintInt};
import Std::Task::{Task_Join, TaskHandle}; import Std::Task::{Task_Wait, TaskHandle};
import Std::Sync::{Mutex, Mutex_New, Mutex_Lock, Mutex_Unlock}; import Std::Sync::{Mutex, Mutex_New, Mutex_Lock, Mutex_Unlock};
struct Counter { struct Counter {
@@ -25,8 +25,8 @@ func Main() -> int {
let a: *void = spawn Incrementer(&counter); let a: *void = spawn Incrementer(&counter);
let b: *void = spawn Incrementer(&counter); let b: *void = spawn Incrementer(&counter);
Task_Join(TaskHandle { handle: a }); Task_Wait(TaskHandle { handle: a });
Task_Join(TaskHandle { handle: b }); Task_Wait(TaskHandle { handle: b });
PrintLine("Counter:"); PrintLine("Counter:");
PrintInt(counter.value); PrintInt(counter.value);