Commit Graph

23 Commits

Author SHA1 Message Date
christos 55f47ec332 Replace the simple implementation of pthread_key_{create,destroy}
and pthread_{g,s}etspecific functions, to one that invalidates
values of keys in other threads when pthread_key_delete() is called.
This fixes chromium, which expects pthread_key_delete() to do
cleanup in all threads.
2012-11-21 19:19:24 +00:00
matt 426a76190c Only copy the ucontext_t in pthread_setcontext if _UC_TLSBASE is set.
Conditionalize the test on _UC_TLSBASE being defined.
2012-09-12 14:55:48 +00:00
manu bba80928a8 setcontext() used to be incompatible with -lpthread since it affected
the TLS pointer, therefore wrecking the pthread environement.

Some ports had _UC_TLSBASE flag or equivalent (_UC_UNIQUE on alpha)
that controlled whether setcontext() would change the TLS pointer.
This change let libpthread override setcontext() with its own version
that unsets _UC_TLSBASE, enabling safe usage of setcontext() with
-lpthread.

We also have the following required changes here:
- rename alpha's _UC_UNIQUE into _UC_TLSBASE
- add _UC_TLSBASE definition in header file for all ports
  (powerpc, sh3, sparc and sparc64 lack the implementation for now)
- introduce a libc stub that can be overriden for setcontext()
- modify MD libcs swapcontext() implementations so that they use the
  setcontext() libc stub instead of doing a plain system call.

While we are there:
- document various MD _UC_* flags in header file
- add libc and libpthread tests for swapcontext() behavior
  (hopefully helpful to spot MD problems introduced with this change)

Future work:
- Deciding whether kernel support or _UC_TLSBASE should be added for
  powerpc, sh3, sparc and sparc64 is left to portmasters
  sparc64

Approved by core@
2012-09-12 02:00:51 +00:00
ad edbc7575cc pthread_curcpu_np: remove hack for pthread_dummy_lwpctl. 2008-06-23 10:38:39 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad 783e2f6db5 Back out previous. It seems to expose another bug in libpthread/libc,
potentially errno being used before threading is up and running.
2008-03-22 14:19:27 +00:00
ad 159f554369 Move pthread__errno() into pthread_specific.c so it gets the "no stack
frame" treatment.
2008-03-21 21:35:43 +00:00
christos 6c924f05f9 cast -1 to unsigned int. 2008-01-08 20:55:58 +00:00
yamt 48a1e4cf46 pthread_curcpu_np: map LWPCTL_CPU_NONE to 0 so that this works in the case
of _lwp_ctl failure.
2008-01-07 11:51:43 +00:00
ad 37132d5d2f Back out previous now that libc/libpthread are initialized first. 2007-12-07 20:36:52 +00:00
ad 64ebe1397e Hack around ld.so initializing pthread users before libpthread/libc. 2007-12-01 01:19:31 +00:00
ad 4084ca7f3f Add thr_curcpu(), pthread_curcpu_np(). 2007-11-27 20:58:26 +00:00
ad 9202b10ca9 Cosmetic change. 2007-11-13 01:21:32 +00:00
ad b8833ff53f - Reinitialize the absolute minimum when recycling user thread state.
Chops another ~10% off create/join in a loop on i386.
- Disable low level debugging as this is stable. Improves benchmarks
  across the board by a small percentage. Uncontested mutex acquire
  and release in a loop becomes about 8% quicker.
- Minor cleanup.
2007-08-16 12:01:49 +00:00
nathanw bd9a18b79f Split out pthread_{set,get}specific() into a separate file and arrange
for that file to not be built with profiling. This makes it reasonable to
use pthread_{set,get}specific() to implement thread-safe profiline call counts.
2003-08-13 18:52:01 +00:00
nathanw 608b92c095 Don't use PTHREAD_DESTRUCTOR_ITERATIONS; the constant is going away. 2003-07-17 20:40:43 +00:00
wiz 76907a433e Fix typo in comment. 2003-05-15 19:16:37 +00:00
nathanw a06836c083 Remove an unnecessary test in pthread_getspecific(). 2003-05-15 19:13:24 +00:00
lukem f043c0fb57 add __RCSID() 2003-03-08 08:03:34 +00:00
nathanw ca0eaa6f66 Remove unused #include <assert.h> 2003-02-15 04:39:16 +00:00
nathanw dc651e62df Don't bother acquiring the tsd_lock and reading the destructor function
if the corresponding TSD entry is empty.

Cuts down lock/unlock pairs for this operation from 256 to the number
of active TSD entries; sicne this is done when every thread exits, it saves
many total lock/unlock pairs.
2003-01-21 23:29:22 +00:00
christos 9631ace572 de-lint 2003-01-18 18:40:52 +00:00
thorpej c62a74e6d5 Merge the nathanw_sa branch. 2003-01-18 10:32:11 +00:00