When I make some tests for nptl, I found pthread_condattr_setclock will always modify the attribute of condition to PTHREAD_PROCESS_PRIVATE, even if the condition is set as PTHREAD_PROCESS_SHARED at first. So the program will be hung if condition is used for LWP. The following line is wrong in nptl/pthread_condattr_setclock.c: *valuep = ((*valuep & ~(1 << (COND_NWAITERS_SHIFT + 1)) & ~1) | (clock_id << 1)); I think it should be correct as follows: *valuep = ((*valuep & ~(1 << (COND_NWAITERS_SHIFT + 1)) & ~0) | (clock_id << 1));
Created attachment 3044 [details] This is the patch for pthread_condattr_setclock not to modify the condition attribute
I think it should be *valuep = ((*valuep & ~(((1 << COND_NWAITERS_SHIFT + 1) - 1) & ~1)) | (clock_id << 1)); in order to correspond to pthread_condattr_getclock().
Fix checked into cvs.