aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-21 17:11:23 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-21 17:11:23 -0400
commitb468ee67f21570d278f80d569eca8ee4149fb7cd (patch)
tree27655cd43ff5e1e8ebc54987a87ed23ab3b5ad1c /examples
parent22b9548b98b52ed2abd1450df15d28bf2a8fc1b4 (diff)
Fix allocations
Diffstat (limited to 'examples')
-rw-r--r--examples/threads/threads.tm6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/threads/threads.tm b/examples/threads/threads.tm
index 5949a5cc..124515b1 100644
--- a/examples/threads/threads.tm
+++ b/examples/threads/threads.tm
@@ -4,7 +4,7 @@ struct Mutex(_mutex:@Memory):
func new(->Mutex):
return Mutex(
inline C : @Memory {
- 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
@@ -24,7 +24,7 @@ struct ThreadCondition(_cond:@Memory):
func new(->ThreadCondition):
return ThreadCondition(
inline C : @Memory {
- 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
@@ -58,7 +58,7 @@ struct PThread(_thread:@Memory):
func new(fn:func() -> PThread):
return PThread(
inline C : @Memory {
- pthread_t *thread = new(pthread_t);
+ pthread_t *thread = GC_MALLOC(sizeof(pthread_t));
pthread_create(thread, NULL, _$fn.fn, _$fn.userdata);
thread
}