UKERNEL: allow creation of non-detached threads
authorAndrew Deason <adeason@sinenomine.net>
Thu, 8 Apr 2010 20:35:12 +0000 (15:35 -0500)
committerDerrick Brashear <shadow@dementia.org>
Fri, 9 Apr 2010 19:42:00 +0000 (12:42 -0700)
Make usr_thread_create create a non-detached thread by default, and
just have callers call usr_thread_detach if they want it detached. The
only current caller of usr_thread_create already calls
usr_thread_detach.

Also add usr_thread_join to make it possible to join a created thread.

Change-Id: Iad581c45d36dc43e94c950a5ca6a41dea8dc4b2f
Reviewed-on: http://gerrit.openafs.org/1722
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/afs/UKERNEL/sysincludes.h

index dca066e..f9f8e78 100644 (file)
@@ -952,10 +952,10 @@ extern pthread_cond_t usr_sleep_cond;
        pthread_attr_t attr; \
        assert(pthread_attr_init(&attr) == 0); \
        assert(pthread_attr_setstacksize(&attr, 124288) == 0); \
-       assert(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) == 0); \
        assert(pthread_create((A), &attr, (B), (void *)(C)) == 0); \
        assert(pthread_attr_destroy(&attr) == 0); \
     } while(0)
+#define usr_thread_join(A,B)   pthread_join(A, B)
 #define usr_thread_detach(A)   pthread_detach(A)
 #define usr_keycreate(A,B)     assert(pthread_key_create(A,B) == 0)
 #define usr_setspecific(A,B)   pthread_setspecific(A,B)