aboutsummaryrefslogtreecommitdiff
path: root/examples/pthreads/pthreads.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-21 17:07:44 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-21 17:07:44 -0400
commit22b9548b98b52ed2abd1450df15d28bf2a8fc1b4 (patch)
tree6d9c430487328eb37c49a0ba2b7b168d66b91573 /examples/pthreads/pthreads.tm
parenta12f0a92275662a199a82a32565a69e2e069e342 (diff)
Update threads allocation code
Diffstat (limited to 'examples/pthreads/pthreads.tm')
-rw-r--r--examples/pthreads/pthreads.tm6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/pthreads/pthreads.tm b/examples/pthreads/pthreads.tm
index b4671d4c..07a80e95 100644
--- a/examples/pthreads/pthreads.tm
+++ b/examples/pthreads/pthreads.tm
@@ -7,7 +7,7 @@ extern pthread_mutex_unlock:func(mutex:&pthread_mutex_t -> Int32)
struct pthread_mutex_t(; extern, opaque):
func new(->@pthread_mutex_t):
return inline C : @pthread_mutex_t {
- pthread_mutex_t *mutex = new(pthread_mutex_t);
+ pthread_mutex_t *mutex = GC_MALLOC(sizeof(pthread_mutex_t));
pthread_mutex_init(mutex, NULL);
GC_register_finalizer(mutex, (void*)pthread_mutex_destroy, NULL, NULL, NULL);
mutex
@@ -26,7 +26,7 @@ extern pthread_cond_broadcast:func(cond:&pthread_cond_t -> Int32)
struct pthread_cond_t(; extern, opaque):
func new(->@pthread_cond_t):
return inline C : @pthread_cond_t {
- pthread_cond_t *cond = new(pthread_cond_t);
+ pthread_cond_t *cond = GC_MALLOC(sizeof(pthread_cond_t));
pthread_cond_init(cond, NULL);
GC_register_finalizer(cond, (void*)pthread_cond_destroy, NULL, NULL, NULL);
cond
@@ -44,7 +44,7 @@ struct pthread_cond_t(; extern, opaque):
struct pthread_t(; extern, opaque):
func new(fn:func() -> @pthread_t):
return inline C : @pthread_t {
- pthread_t *thread = new(pthread_t);
+ pthread_t *thread = GC_MALLOC(sizeof(pthread_t));
pthread_create(thread, NULL, _$fn.fn, _$fn.userdata);
thread
}