UKERNEL: allow creation of non-detached threads

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>
This commit is contained in:
Andrew Deason 2010-04-08 15:35:12 -05:00 committed by Derrick Brashear
parent 2f03d4e6e2
commit f54785bded

View File

@ -952,10 +952,10 @@ extern pthread_cond_t usr_sleep_cond;
pthread_attr_t attr; \ pthread_attr_t attr; \
assert(pthread_attr_init(&attr) == 0); \ assert(pthread_attr_init(&attr) == 0); \
assert(pthread_attr_setstacksize(&attr, 124288) == 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_create((A), &attr, (B), (void *)(C)) == 0); \
assert(pthread_attr_destroy(&attr) == 0); \ assert(pthread_attr_destroy(&attr) == 0); \
} while(0) } while(0)
#define usr_thread_join(A,B) pthread_join(A, B)
#define usr_thread_detach(A) pthread_detach(A) #define usr_thread_detach(A) pthread_detach(A)
#define usr_keycreate(A,B) assert(pthread_key_create(A,B) == 0) #define usr_keycreate(A,B) assert(pthread_key_create(A,B) == 0)
#define usr_setspecific(A,B) pthread_setspecific(A,B) #define usr_setspecific(A,B) pthread_setspecific(A,B)