diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-03-11 13:18:30 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-03-11 13:18:30 -0400 |
| commit | 294b712e6dabc722772f86aaa9d0faaa08c14717 (patch) | |
| tree | f24ab45434d5bf2d5ebd64b0d533d4d361e9daff /examples/threads/threads.tm | |
| parent | d254b440f8359b42a097edfeb2db1585fd20c695 (diff) | |
Don't use '$' prefix for field names
Diffstat (limited to 'examples/threads/threads.tm')
| -rw-r--r-- | examples/threads/threads.tm | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/threads/threads.tm b/examples/threads/threads.tm index 99bb83b4..5949a5cc 100644 --- a/examples/threads/threads.tm +++ b/examples/threads/threads.tm @@ -13,11 +13,11 @@ struct Mutex(_mutex:@Memory): func do_locked(m:Mutex, fn:func(); inline): inline C { - pthread_mutex_lock((pthread_mutex_t*)_$m.$_mutex); + pthread_mutex_lock((pthread_mutex_t*)_$m._mutex); } fn() inline C { - pthread_mutex_unlock((pthread_mutex_t*)_$m.$_mutex); + pthread_mutex_unlock((pthread_mutex_t*)_$m._mutex); } struct ThreadCondition(_cond:@Memory): @@ -33,17 +33,17 @@ struct ThreadCondition(_cond:@Memory): func wait(c:ThreadCondition, m:Mutex; inline): inline C { - pthread_cond_wait((pthread_cond_t*)_$c.$_cond, (pthread_mutex_t*)_$m.$_mutex); + pthread_cond_wait((pthread_cond_t*)_$c._cond, (pthread_mutex_t*)_$m._mutex); } func signal(c:ThreadCondition; inline): inline C { - pthread_cond_signal((pthread_cond_t*)_$c.$_cond); + pthread_cond_signal((pthread_cond_t*)_$c._cond); } func broadcast(c:ThreadCondition; inline): inline C { - pthread_cond_broadcast((pthread_cond_t*)_$c.$_cond); + pthread_cond_broadcast((pthread_cond_t*)_$c._cond); } struct Guard(mutex=Mutex.new(), cond=ThreadCondition.new()): @@ -66,17 +66,17 @@ struct PThread(_thread:@Memory): func join(t:PThread): inline C { - pthread_join(*(pthread_t*)_$t.$_thread, NULL); + pthread_join(*(pthread_t*)_$t._thread, NULL); } func cancel(t:PThread): inline C { - pthread_cancel(*(pthread_t*)_$t.$_thread); + pthread_cancel(*(pthread_t*)_$t._thread); } func detatch(t:PThread): inline C { - pthread_detach(*(pthread_t*)_$t.$_thread); + pthread_detach(*(pthread_t*)_$t._thread); } func main(): |
