Commit Graph

17 Commits

Author SHA1 Message Date
mycroft 8fa85b4a65 gettimeofday();TIMEVAL_TO_TIMESPEC(); is exactly equivalent to
clock_gettime(CLOCK_REALTIME), except the latter may have more preicison
some day.  So, use that.
2005-01-06 17:33:36 +00:00
nathanw cb9ebec1e2 Correctly return ETIMEDOUT when the absolute time is in the past, in
the nonthreaded case. Fixes, and fix from, PR lib/25961.
2004-12-10 17:11:53 +00:00
nathanw 8bf7374bcf In cond_wait() and cond_timedwait(), do the ERRORCHECK testing of the
waiters list in all cases, not just on cancellation; there are other
sources of spurious wakeups, such as single-stepping in the debugger.

regress/lib/libpthread/conddestroy1 now passes.
2004-07-27 21:44:48 +00:00
kleink 5a6f0c93e7 In the nothread version, don't return EINTR if select() was interrupted
since this value is explicitly ruled out by POSIX.  Instead, return 0,
like a spurious wakeup.  From YAMAMOTO Takashi in PR standards/24240.
2004-05-03 09:13:34 +00:00
cl 774b4b225b Update mutex/rwlock/sem code to match recent change in cond code. 2003-11-24 23:54:13 +00:00
nathanw 250e7bbf8e Fix a race between timed wait callbacks and manual signal/broadcasting
accidentally introduced in rev. 1.5.

Noted by Christian Limpach.
2003-11-24 22:54:31 +00:00
nathanw 4e755ddba8 Prevent ptc_mutex from remaining set if a CV sleep is woken by
cancellation:

 * Arrange to not set ptc_mutex until after the pre-sleep cancellation
   test.

 * In the post-sleep cancellation test, check if there are no more
   sleepers and clear ptc_mutex if so.

While here, sprinkle some __predict_false() around the cancellation
tests.
2003-11-21 22:08:00 +00:00
nathanw 3f6de8d84a Use pthread__error() instead of pthread__abort(). 2003-04-23 19:36:12 +00:00
nathanw b7ac97b866 More agressive assertions. Change a number of detected conditions, which
officially have undefined behavior, from returning an error code to raising
an assertion failure.
Also, don't bother to explicitly test for (illegal) null pointers and return
an error; they'll bomb out soon enough.
2003-04-18 21:36:38 +00:00
nathanw 008033bb65 When a thread sleeps on a mutex or cv, have it put itself on the
front of the sleep queue rather than the back. This is more
cache-friendly behavior and within the (lack of) constraints on wakeup
ordering imposed on equal-priority threads.
2003-04-16 18:30:43 +00:00
lukem f043c0fb57 add __RCSID() 2003-03-08 08:03:34 +00:00
nathanw de9d8cde2a Remove debug toggle and add debug counter for signals and broadcasts
that actually wake another thread up.
2003-02-15 04:38:33 +00:00
nathanw 947e41dfa9 Arrange to pause for a while if pthread_cond_wait() or
pthread_cond_timedwait() is called before any threads have been
created and the SA infrastructure is up and running.

Addresses PR lib/20139.

XXX probably need to do this for all of the pthread_*_timedlock()
functions, too.
2003-02-01 00:57:31 +00:00
nathanw 96b5a26db2 Use pthread__sched_sleepers() instead of iterating over sleep queues
ourself.
2003-01-31 04:59:40 +00:00
nathanw 69367db47f Do a similar tuneup on pthread_cond_signal() and
pthread_cond_broadcast(): use double-checked locking to avoid
pthread__self() and pthread_spinlock() when signaling or broadcasting
on a condition variable with no waiters.
2003-01-31 04:26:50 +00:00
nathanw 6505a5330c Add debug counters for mutex and condvar operations. 2003-01-27 21:01:00 +00:00
thorpej c62a74e6d5 Merge the nathanw_sa branch. 2003-01-18 10:32:11 +00:00