diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-09-29 16:29:44 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-09-29 16:29:47 -0700 |
| commit | 6bb0399df2123a2a87262b0f36ba0e56f1de787b (patch) | |
| tree | ff3c2885bf8bdb52e6e024c64c1a2890ce479ae3 /src/rt/sync/rust_thread.cpp | |
| parent | 42c6265a8c38bbf899b7afbb15fc6de50ab210c5 (diff) | |
| download | rust-6bb0399df2123a2a87262b0f36ba0e56f1de787b.tar.gz rust-6bb0399df2123a2a87262b0f36ba0e56f1de787b.zip | |
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
Diffstat (limited to 'src/rt/sync/rust_thread.cpp')
| -rw-r--r-- | src/rt/sync/rust_thread.cpp | 12 |
1 files 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 } |
