Commit Graph

460 Commits

Author SHA1 Message Date
ad
b5a5e72af1 Mirror a fix made to the kernel's condvars:
After resuming execution, the thread must check to see if it
has been restarted as a result of pthread_cond_signal().  If it
has, but cannot take the wakeup (because of eg a pending Unix
signal or timeout) then try to ensure that another thread sees
it.  This is necessary because there may be multiple waiters,
and at least one should take the wakeup if possible.
2007-04-12 21:36:06 +00:00
scw
5764a76889 Remove support for NetBSD/{,evb}sh5. 2007-04-08 09:35:21 +00:00
ad
a5070151ae - Test+branch is usually cheaper than making an indirect function call,
so avoid making them.
- When parking an LWP on a condition variable, point the hint argument at
  the mutex's waiters queue. Chances are we will be awoken from that later.
2007-03-24 18:51:59 +00:00
ad
1dd83d7758 Move PTHREADD_ADD(PTHREADD_COND_WOKEUP) back to the correct spot. 2007-03-21 19:08:18 +00:00
ad
a63c21f286 PR lib/34931: PTHREAD_ATTR(3) doesn't document PTHREAD_CREATE_JOINABLE and
PTHREAD_CREATE_DETACHED macros. From Matthew Mondor.
2007-03-21 18:53:32 +00:00
ad
d68cf1be1a - When signalling waiters, try not to awaken them immediatley. If we hold
the mutex that the waiters are using to synchronise, then transfer them
  to the mutex's waiters list so that the wakeup is deferred until release
  of the mutex. Improves the timings for CV sleep/wakeup by between 30-100%
  in tests conducted locally on a UP system. There can be a penalty for MP
  systems when only one thread is being awoken, but in practice I think it
  won't be be an issue.
- pthread_signal: search for a thread that does not have a pending wakeup.
  Threads can have a pending wakeup and still be on the waiters list if we
  clash with an earlier pthread_cond_broadcast().
2007-03-20 23:49:58 +00:00
ad
b0427b61fb - Maintain a per-thread pointer to the last mutex acquired by the app, to
be used only as as a hint. Clear the pointer when releasing the mutex.
- When releasing a mutex, wake all waiters. Makes it possible to tranfer
  waiters from another object to a mutex.
2007-03-20 23:33:10 +00:00
ad
bfa3094e84 Cosmetic changes. 2007-03-14 23:34:48 +00:00
ad
0c61b6a65c - pthread__park: always check for cancellation.
- pthread__unpark: cosmetic changes.
2007-03-14 23:33:42 +00:00
ad
3cf001f506 - Update to match changed pthread__park() interface.
- Simplify the locking in sem_wait().
2007-03-05 23:56:44 +00:00
ad
c79299e2ec Update to match changed pthread__park() interface. 2007-03-05 23:56:17 +00:00
ad
fe47a5c777 - Update to match changed pthread__park() interface.
- Fix a bug where a thread could be "reentered" onto the waiters queue.
2007-03-05 23:55:54 +00:00
ad
792cc0e17d - Simplify the interface to pthread__park() and friends slightly.
- If sysctl() fails, complain.
2007-03-05 23:55:40 +00:00
ad
8c1c910253 - Sync with reality.
- Minor cosmetic changes.
2007-03-05 23:53:53 +00:00
ad
da3cc0ffcf Cosmetic and minor debugging changes. 2007-03-05 23:30:17 +00:00
ad
f1c2a5c056 Undo previous, it matches IEEE 1003.1. 2007-03-05 22:25:27 +00:00
ad
d6d036f667 Drop the interlock if cancelled. 2007-03-05 22:11:40 +00:00
ad
1f1ddafc0c Add __sigsuspend14, sigtimedwait as cancellation points. 2007-03-04 20:07:13 +00:00
ad
44e5b56619 Fix a sleep/wakeup race with condvars. 2007-03-02 19:56:47 +00:00
ad
67513ce0a2 Silence a gcc/lint warning. 2007-03-02 18:58:45 +00:00
ad
de2138164c Remove the PTHREAD_SA option. If M:N threads is reimplemented it's
better off done with a seperate library.
2007-03-02 18:53:51 +00:00
ad
dba14ef0a0 Don't grab the state lock to check for cancellation around condition
variables, as _lwp_wakeup/lwp_park provide the necessary barrier.
2007-03-02 17:47:40 +00:00
ad
dc39f9ec83 pthread_detach: acquire the join lock before changing pt_flags. 2007-03-02 17:40:55 +00:00
ad
1bcb6087a6 On x86, issue the pause instruction while spinning. 2007-03-02 17:34:21 +00:00
ad
1296e8508f - Put detached & exiting threads on the tail of the deadqueue, not head.
- Don't forget to set PT_FLAG_DETACHED.
2007-02-21 22:31:38 +00:00
ad
dacd4bd9ca Minor optimisation to previous: only check for continued existence of
the thread if it was detached.
2007-02-21 22:25:57 +00:00
yamt
4cdc2ed889 fix a race between pthread_exit and pthread_create.
inefficient, but better than crashing.
2007-02-15 15:39:33 +00:00
ad
3247035dcc Cast the return value of _lwp_unpark_all(), just in case. 2007-02-09 23:53:24 +00:00
ad
a21c37097e Bump libpthread & libpthread_dbg minor versions so that an old SA copy
gets kept in the file system. Requested by pavel.
2007-02-09 23:00:16 +00:00
ad
401499f30e Sync with kernel changes introduced by merging the newlock2 branch. 2007-02-09 22:08:48 +00:00
ad
d333bb5f2f Build without sys/sa.h present. 2007-02-06 15:24:37 +00:00
christos
858097f9a1 use __func__ instead of __FUNCTION__ which is a gcc extension. 2007-01-31 23:55:20 +00:00
christos
bbc680871a Add another volatile, mentioned in current-users from a cross-build on amd64. 2007-01-22 15:06:31 +00:00
ad
7630e3876c pthread_create(): clear newthread->pt_sleeponq before calling _lwp_create(). 2007-01-20 20:02:36 +00:00
christos
1eb6e5fbb2 add casts to pacify lint. 2007-01-20 18:58:11 +00:00
christos
25a0745d2e remove unused variable/code. 2007-01-20 18:57:41 +00:00
christos
d1ddfe10b1 fix warning about indirect call without * 2007-01-20 18:56:30 +00:00
christos
b4634d8561 sprinkle volatile. 2007-01-20 18:00:15 +00:00
christos
1636e22df7 set warns to 4 2007-01-20 04:56:25 +00:00
christos
3ca3d0b1e7 add a missing volatile. 2007-01-20 04:56:07 +00:00
hubertf
55ac93d329 Remove more duplicate #includes, and a few spurious whitespaces at EOL
From Slava Semushin <slava.semushin@gmail.com>
2007-01-17 23:24:22 +00:00
ad
8e51dbdc7e For 1:1 threads: __strong_alias(__libc_thr_yield,_sys_sched_yield) 2007-01-16 07:09:17 +00:00
ad
b8daad9836 Fix a race between pthread_exit() and pthread_join(). 2007-01-16 05:22:55 +00:00
ad
efb1fc06e2 Fix a race between pthread_create() and pthread_exit() in the 1:1 case. 2007-01-16 04:19:02 +00:00
ad
39aa27f5ce Pass in the 'hint' argument when parking/unparking LWPs. 2007-01-16 01:35:16 +00:00
drochner
9c848e15d6 bring sched_yield() back which got lost recently 2007-01-08 20:54:42 +00:00
ad
ae979b2162 Add some items for 1:1 threads. 2006-12-25 11:36:36 +00:00
ad
ded2602507 Fix bugs with and improve upon previous. 2006-12-24 18:39:45 +00:00
ad
fe9718ac7c Add another comment. 2006-12-23 09:48:18 +00:00
ad
10058f19c8 Add a comment. 2006-12-23 05:18:56 +00:00