From 22b9548b98b52ed2abd1450df15d28bf2a8fc1b4 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 21 Mar 2025 17:07:44 -0400 Subject: Update threads allocation code --- examples/pthreads/pthreads.tm | 6 +++--- 1 file 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 } -- cgit v1.2.3