aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-19 16:22:29 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-19 16:22:29 -0400
commite0a386fa8f884610ed1005462740d5db57d4ad3e (patch)
treecbd29d73d5381d776c1bea18adb0164968194cc3 /examples
parentf3b8529e01f66f4743d26a62237706a09a2f1f71 (diff)
Replace "begin"/"end" with "do_begin"/"do_end"
Diffstat (limited to 'examples')
-rw-r--r--examples/pthreads/pthreads.tm12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/pthreads/pthreads.tm b/examples/pthreads/pthreads.tm
index 13d94e40..b4671d4c 100644
--- a/examples/pthreads/pthreads.tm
+++ b/examples/pthreads/pthreads.tm
@@ -58,14 +58,14 @@ struct IntQueue(_queue:@[Int], _mutex:@pthread_mutex_t, _cond:@pthread_cond_t):
return IntQueue(@initial, pthread_mutex_t.new(), pthread_cond_t.new())
func give(q:IntQueue, n:Int):
- begin: q._mutex:lock()
- end: q._mutex:unlock()
+ do_begin: q._mutex:lock()
+ do_end: q._mutex:unlock()
do: q._queue:insert(n)
q._cond:signal()
func take(q:IntQueue -> Int):
- begin: q._mutex:lock()
- end: q._mutex:unlock()
+ do_begin: q._mutex:lock()
+ do_end: q._mutex:unlock()
do:
repeat:
if n := q._queue:pop(1):
@@ -79,8 +79,8 @@ func main():
say_mutex := pthread_mutex_t.new()
announce := func(speaker:Text, text:Text):
- begin: say_mutex:lock()
- end: say_mutex:unlock()
+ do_begin: say_mutex:lock()
+ do_end: say_mutex:unlock()
do: say("$\033[2m[$speaker]$\033[m $text")
worker := pthread_t.new(func():