pthread: Make pthread barriers 2LS-independent
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 28 Apr 2017 16:36:44 +0000 (12:36 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 3 May 2017 16:16:41 +0000 (12:16 -0400)
commit6fe7e387b53279add4e42e230f2abc66ab444bdf
treea8796bc177382e79becac2fbd4a5843fc91e5a57
parentce476adff0f377ddae211fb5d4916d5a3cfec74f
pthread: Make pthread barriers 2LS-independent

This is one step towards making pthreads a generic API that can be used
when *any* 2LS is used.  Long term, we'll need that so library code can
make pthread calls (e.g. pthread_create(), pthread_mutex_lock(), etc.) and
access the real 2LS.  The alternative is porting every POSIX library that
wants to grab a thread.

Thanks to the previous commits, we're able to swap in uthreads for pthreads
and use sync object with bulk wakeups directly.  The first couple
implementations of this didn't have bulk wakeups or called
uthread_has_blocked() while holding the barrier's lock.  Both of those
noticeably hurt performance.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/pthread/pthread.c
user/pthread/pthread.h