Skip to content

Commit 6bb0399

Browse files
committed
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
1 parent 42c6265 commit 6bb0399

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/rt/sync/rust_thread.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ rust_thread::start() {
3232
thread = CreateThread(NULL, stack_sz, rust_thread_start, this, 0, NULL);
3333
#else
3434
pthread_attr_t attr;
35-
pthread_attr_init(&attr);
36-
pthread_attr_setstacksize(&attr, stack_sz);
37-
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
38-
pthread_create(&thread, &attr, rust_thread_start, (void *) this);
35+
CHECKED(pthread_attr_init(&attr));
36+
CHECKED(pthread_attr_setstacksize(&attr, stack_sz));
37+
CHECKED(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE));
38+
CHECKED(pthread_create(&thread, &attr, rust_thread_start, (void *) this));
3939
#endif
4040
}
4141

@@ -46,7 +46,7 @@ rust_thread::join() {
4646
WaitForSingleObject(thread, INFINITE);
4747
#else
4848
if (thread)
49-
pthread_join(thread, NULL);
49+
CHECKED(pthread_join(thread, NULL));
5050
#endif
5151
thread = 0;
5252
}
@@ -56,6 +56,6 @@ rust_thread::detach() {
5656
#if !defined(__WIN32__)
5757
// Don't leak pthread resources.
5858
// http://crosstantine.blogspot.com/2010/01/pthreadcreate-memory-leak.html
59-
pthread_detach(thread);
59+
CHECKED(pthread_detach(thread));
6060
#endif
6161
}

0 commit comments

Comments
 (0)