summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_cond.c
Commit message (Collapse)AuthorAgeFilesLines
* Lock the cond queue (condition variables):mtm2003-05-241-70/+43
| | | | | | | | | | | | | | | | Access to the thread's flags and state is protected by _thread_critical_enter/exit(). When a thread is signaled with a condition its state must be protected by locking it and disabling signals before it is taken of the waiters' queue. Move the implementation of pthread_cond_signal() and pthread_cond_broadcast() into one function, cond_signal(). Its behaviour is determined by the last argument, int broadcast. If this is set to 1 it will remove all waiters, otherwise it will wake up only the first waiter thread. Remove an extraneous call to pthread_testcancel(). Approved by: re/blanket libthr
* Insert a debugging aid:mtm2003-05-211-1/+9
| | | | | | | | When in either the mutex or cond queue we notice that the thread is already on one of the queues, don't just simply abort(). Print out the thread's identifiers and what queue it was on. Approved by: markm/mentor, re/blanket libthr
* Do some cleanup with respect to condition variables. The implementationmtm2003-05-151-15/+14
| | | | | | | | | | | | of pthread_cond_timedwait() is moved into cond_wait_common(). Pthread_cond_wait() and pthread_cond_timedwait() are now wrappers around this function. Previously, the former called the latter with the abstime pointing to 0 time. This violated Posix semantics should an application have reason to call it with that argument because instead or returning immediately it would have waited indefinitely for the cv to be signaled. Approved by: markm/mentor, re/blanket libthr Reviewed by: jeff
* - Define curthread as _get_curthread() and remove all direct calls tojeff2003-04-021-6/+0
| | | | | | | _get_curthread(). This is similar to the kernel's curthread. Doing this saves stack overhead and is more convenient to the programmer. - Pass the pointer to the newly created thread to _thread_init(). - Remove _get_curthread_slow().
* - Don't drop and reacquire giant in thread_suspend(). Change callers to dojeff2003-04-011-0/+2
| | | | | this manually. This will facilitate the unrolling of giant. - Don't allow giant to recurse anymore. This should never happen.
* - Add libthr but don't hook it up to the regular build yet. This is anjeff2003-04-011-0/+544
adaptation of libc_r for the thr system call interface. This is beta quality code.
OpenPOWER on IntegriCloud