From 6bb0399df2123a2a87262b0f36ba0e56f1de787b Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 29 Sep 2012 16:29:44 -0700 Subject: [PATCH] rt: Check the results of pthread calls The stage0 compiler is not working on an x86_64 debian wheezy instance and it looks like maye pthread_create is failing --- src/rt/sync/rust_thread.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/rt/sync/rust_thread.cpp b/src/rt/sync/rust_thread.cpp index 5d533acde3d..02fecd440f8 100644 --- a/src/rt/sync/rust_thread.cpp +++ b/src/rt/sync/rust_thread.cpp @@ -32,10 +32,10 @@ rust_thread::start() { thread = CreateThread(NULL, stack_sz, rust_thread_start, this, 0, NULL); #else pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setstacksize(&attr, stack_sz); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - pthread_create(&thread, &attr, rust_thread_start, (void *) this); + CHECKED(pthread_attr_init(&attr)); + CHECKED(pthread_attr_setstacksize(&attr, stack_sz)); + CHECKED(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE)); + CHECKED(pthread_create(&thread, &attr, rust_thread_start, (void *) this)); #endif } @@ -46,7 +46,7 @@ rust_thread::join() { WaitForSingleObject(thread, INFINITE); #else if (thread) - pthread_join(thread, NULL); + CHECKED(pthread_join(thread, NULL)); #endif thread = 0; } @@ -56,6 +56,6 @@ rust_thread::detach() { #if !defined(__WIN32__) // Don't leak pthread resources. // http://crosstantine.blogspot.com/2010/01/pthreadcreate-memory-leak.html - pthread_detach(thread); + CHECKED(pthread_detach(thread)); #endif }