Commit Graph

390 Commits

Author SHA1 Message Date
davidxu
fcda4340a4 Move checking for c_has_waiters into low level _thr_ucond_signal and
_thr_ucond_broadcast, clear condition variable pointer in cancellation
info after returing from _thr_ucond_wait, since kernel has already
dropped the internal lock, so we don't need to unlock it in cancellation
handler again.
2006-12-12 03:08:49 +00:00
davidxu
33168bd24f test cancel_pending to save a thr_wake call in some specical cases. 2006-12-06 00:15:35 +00:00
davidxu
b01e86cf0a _thr_ucond_wait drops lock, we should pick it up again. 2006-12-05 23:46:11 +00:00
davidxu
3f73376426 the c_has_waiters is lazily updated, temporarily disable the false
alarm code.
2006-12-05 07:23:58 +00:00
davidxu
f26900460b Use ucond to implement barrier. 2006-12-05 06:54:25 +00:00
davidxu
f1f5293365 Add _thr_ucond_init(). 2006-12-05 06:53:44 +00:00
davidxu
19c999e75f Tweak _thr_cancel_leave_defer a bit to fix a possible race. 2006-12-05 05:01:57 +00:00
davidxu
5ad129a10a Fix typo, I was using a wrong header file, and the typo is not detected
by compiler.
2006-12-04 14:27:42 +00:00
davidxu
cbb0fd8174 Use kernel provided userspace condition variable to implement pthread
condition variable.
2006-12-04 14:20:41 +00:00
davidxu
61e0842016 If a thread was detached, return EINVAL instead, the error code
is also returned by pthread_detach() if a thread was already
detached, the error code was already documented:

>    [EINVAL]	The implementation has detected that the value speci-
>		fied by thread does not refer to a joinable thread.
2006-11-28 11:05:31 +00:00
ru
815d860c2f - When building world WITHOUT_LIBPTHREAD, link libthr to libpthread.
- Don't build ngctl(8) and cached(8) if threading libs aren't built.
- Fix various issues in a cached(8) makefile.
2006-11-26 14:36:34 +00:00
davidxu
add205129c Eliminate atomic operations in thread cancellation functions, it should
reduce overheads of cancellation points.
2006-11-24 09:57:38 +00:00
davidxu
cc0840138e Move code calculating new inherited priority into single function. 2006-11-11 13:33:47 +00:00
davidxu
e8a2970aaf Don't inherit THR_FLAGS_NEED_SUSPEND for child process, child process
only has one thread, setting the flag can cause the thread to be
suspended and no another thread will resume it.
2006-10-14 13:40:08 +00:00
davidxu
653013bedc o Make _thr_umutex_init a function.
o Eliminate unused parameter for some functions.
o Convert type of first parameter to void * for _thr_umtx_wait
  and _thr_umtx_wake.
2006-10-13 22:31:00 +00:00
davidxu
4fdad8dba6 Use type pthread_state for thread state. 2006-10-13 12:45:21 +00:00
davidxu
d2c57b7fad use rtprio_thread system call to get or set thread priority. 2006-09-21 04:21:30 +00:00
davidxu
e83ab88356 Use return value of _thr_umutex_lock instead of using zero. 2006-09-08 09:29:14 +00:00
davidxu
21e4536026 Replace internal usage of struct umtx with umutex which can supports
real-time if we want, no functionality is changed.
2006-09-06 04:04:10 +00:00
davidxu
567ba06917 Same as pthread_setschedparam, use sizeof(struct sched_param) instead. 2006-09-05 14:39:06 +00:00
davidxu
5b28602728 Pass correct parameter size. 2006-09-05 14:37:22 +00:00
marcel
d21513035e Stylize: avoid using a global register variable. 2006-09-01 21:01:11 +00:00
marcel
2d71eb396a Rename TLS_TP_OFFSET back to TP_OFFSET. The former clashes with rtld. 2006-09-01 06:36:00 +00:00
marcel
1125db3243 Stylize. 2006-09-01 06:15:00 +00:00
marcel
6a1762d589 Stylize. 2006-08-31 23:31:18 +00:00
marcel
5ffd88a18e TLS fixes:
o  The TLS pointer (r2) points 0x7000 after the *end* of the TCB.
o  _rtld_allocate_tls() gets a pointer to the current TCB, not the
   current TLS pointer.
o  _rtld_free_tls() gets the size of the TCB structure.
2006-08-31 19:16:47 +00:00
marcel
c088f26c25 Fix harmless bug: sizeof(tcb) equals sizeof(void*) not sizeof(struct tcb).
The argument is (currently) not used by _rtld_free_tls().
2006-08-31 19:06:30 +00:00
marcel
4736b1fdce o Set TP using inline assembly to avoid dead code elimination.
o  Eliminate _tcb.
2006-08-30 03:31:32 +00:00
davidxu
37473cc569 Remove unused file. 2006-08-29 13:01:23 +00:00
davidxu
faa99f1910 pthread_sigmask is in thr_sig.c, remove this file. 2006-08-28 12:29:54 +00:00
davidxu
b7dde83f82 Kill unused files. 2006-08-28 05:01:31 +00:00
davidxu
58fc7458af Use umutex APIs to implement pthread_mutex, member pp_mutexq is added
into pthread structure to keep track of locked PTHREAD_PRIO_PROTECT mutex,
no real mutex code is changed, the mutex locking and unlocking code should
has same performance as before.
2006-08-28 04:52:50 +00:00
davidxu
77e7cda2cf Add umutex APIs. 2006-08-28 04:47:27 +00:00
ru
4d582ffe09 Remove alpha left-overs. 2006-08-22 08:03:01 +00:00
davidxu
c8a98491d0 Axe unused member field. 2006-08-08 05:04:43 +00:00
davidxu
cfa46376c7 Get number of CPUs and ignore spin count on single processor machine. 2006-08-08 04:42:41 +00:00
davidxu
5193e44c40 1. Don't override underscore version of aio_suspend(), system(),
wait(), waitpid() and usleep(), they are internal versions and
   should not be cancellation points.
2. Make wait3() as a cancellation point.
3. Move raise() and pause() into file thr_sig.c.
4. Add functions _sigsuspend, _sigwait, _sigtimedwait and _sigwaitinfo,
   remove SIGCANCEL bit in wait-set for those functions, the signal is
   used internally to implement thread cancellation.
2006-07-25 12:50:05 +00:00
delphij
36c285d128 Unexpand two TAILQ_FOREACH_SAFE cases.
Ok'ed by:	davidxu
2006-07-17 09:23:44 +00:00
davidxu
2b1dbc0acb Caching scheduling policy and priority in userland, a critical but baddly
written application is frequently changing thread priority for SCHED_OTHER
policy.
2006-07-13 22:45:19 +00:00
davidxu
19b8418903 Use thr_setscheduler, thr_getscheduler and thr_setschedparam to implement
pthread functions.
2006-07-13 06:35:43 +00:00
davidxu
ecacf536b0 Use kernel facilities to support real-time scheduling. 2006-07-12 06:13:18 +00:00
davidxu
f53e1c9383 __error could be called too early before libthr is initialized, test
this case and return global varible errno instead.
2006-07-12 03:44:05 +00:00
davidxu
be54fdbbff Remove unused member. 2006-06-03 00:19:40 +00:00
davidxu
523fcb36a8 Remove unused member field m_queue. 2006-06-02 08:37:01 +00:00
delphij
6e4a34202a Explicitly request pre-zeroed memory instead of memset'ing our
own.

Ok'ed by:	davidxu
2006-05-31 00:31:38 +00:00
davidxu
975a6925fe Add symbol versions: FBSD_1.0 and FBSDprivate. 2006-05-11 07:02:52 +00:00
davidxu
6a9d879cfe s/long/int. 2006-04-27 08:25:13 +00:00
davidxu
66d0fee031 - Use same priority range returned by kernel's sched_get_priority_min()
and sched_get_priority_max() syscalls.
- Remove unused fields from structure pthread_attr.
2006-04-27 08:18:23 +00:00
davidxu
8001df6f90 Remove multiple _get_curthread() calls. 2006-04-23 11:23:37 +00:00
ru
450f399135 Install shared libpthread library into /lib; needed by some
/sbin programs.
2006-04-12 19:42:20 +00:00
davidxu
7d0c23506c Do not check validity of timeout if a mutex can be acquired immediately.
Completly drop recursive mutex in pthread_cond_wait and restore recursive
after resumption. Reorganize code to make gcc to generate better code.
2006-04-08 13:24:44 +00:00
davidxu
f921934131 Remove declaration of _thr_initial from MD header file, it is no longer
needed.
2006-04-04 03:35:26 +00:00
davidxu
8bff50a485 Simplify _get_curthread() and _tcb_ctor because libc and rtld now
already allocate thread pointer space in tls block for initial thread.
Only i386 and amd64 have been done, others still have to be tested.
2006-04-04 03:26:06 +00:00
davidxu
31f2b819c6 WARNS level 4 cleanup. 2006-04-04 02:57:49 +00:00
des
5438ed2ce6 Fix prototype mismatch. 2006-03-28 21:46:55 +00:00
davidxu
255936645e Remove priority mutex code because it does not work correctly,
to make it work, turnstile like mechanism to support priority
propagating and other realtime scheduling options in kernel
should be available to userland mutex, for the moment, I just
want to make libthr be simple and efficient thread library.

Discussed with: deischen, julian
2006-03-27 23:50:21 +00:00
davidxu
4b5909711d Comment out -g compiler option, found by 'FreeBSD Build Options Survey'. 2006-03-27 05:58:58 +00:00
davidxu
32673f0256 Check cancellation state carefully to see we really need to call
_pthread_testcancel(). Preserve errno in _thr_suspend_check().
2006-03-26 01:57:03 +00:00
davidxu
2926ddf5d1 Don't cancel thread if it is in critical region. 2006-03-25 07:03:13 +00:00
davidxu
679e2338c0 Only wake up writer if the lock is free. 2006-03-25 05:14:21 +00:00
davidxu
cba4d932c1 Compile thr_rtld.c 2006-03-25 05:00:54 +00:00
davidxu
6ee36bbb6d Add locking support for rtld. 2006-03-25 04:49:07 +00:00
davidxu
eb9bdb4259 set an upper limit for thread structures which can be allocated. 2006-03-24 04:34:06 +00:00
davidxu
020594940d Set default contention scope to system. 2006-03-20 03:14:14 +00:00
ru
5f8b6d3c5a Convert NO_PROFILE and NO_LIB32 to new style. 2006-03-18 21:37:05 +00:00
davidxu
d119bdaa7a Remove mqueue and timer, now they are in librt. 2006-03-08 23:47:04 +00:00
deischen
e586a0042e Add some more pthread stubs so that librt can use them.
The thread jump table has been resorted, so you need to
keep libc, libpthread, and libthr in sync.

Submitted by:	xu
2006-03-05 18:10:28 +00:00
davidxu
6fdf2b7d81 Reimplement mutex_init to get rid of compile warning. 2006-02-28 06:06:19 +00:00
davidxu
bb43155dbb Disable POSIX SIGEV_THREAD notification support, soon we will have a common
library which can be reused both for libthr and libpthread.
2006-02-22 02:52:22 +00:00
davidxu
91fda076fb Read cycle count before sending signal, this fixes a userland thread
suspension bug.

MFC after: 3 days
2006-02-20 09:02:40 +00:00
davidxu
70ea4e1323 Rework last change of pthread_once, create a function _thr_once_init to
reinitialize its internal locks.
2006-02-15 23:05:03 +00:00
davidxu
44a8ce5006 After fork(), reinitialize internal locks for pthread_once(). 2006-02-15 13:41:02 +00:00
davidxu
08b1c5c928 Now, thread name is stored in kernel, userland no longer has to keep it. 2006-02-05 03:04:54 +00:00
davidxu
118990614c use syscall thr_set_name to implement pthread_set_name_np. 2006-02-05 02:26:17 +00:00
davidxu
3172ccca0f Add missing symbol pthread_set_name_np. 2006-01-23 06:11:23 +00:00
davidxu
97a1cdabb8 Eliminate unused code. 2006-01-16 05:33:48 +00:00
davidxu
aedf24a684 Enable mutex inheritance code in mutex_fork, I forgot to turn on it.
while here, add some comments about process shared mutex.
2006-01-14 11:33:43 +00:00
jasone
e30d92806f Increase the number of spinlocks, since libc's malloc implementation is
about to significantly increase the number of spinlocks used.

Approved by:	markm (mentor)
2006-01-13 06:14:04 +00:00
jasone
3668a2e494 In preparation for a new malloc implementation:
* Add posix_memalign().

  * Move calloc() from calloc.c to malloc.c.  Add a calloc() implementation in
    rtld-elf in order to make the loader happy (even though calloc() isn't
    used in rtld-elf).

  * Add _malloc_prefork() and _malloc_postfork(), and use them instead of
    directly manipulating __malloc_lock.

Approved by:	phk, markm (mentor)
2006-01-12 07:28:21 +00:00
davidxu
84187b477c The thr_new sysscall was already in libc, don't generate it. 2006-01-11 06:10:05 +00:00
davidxu
1218aa5627 Use macro STATIC_LIB_REQUIRE to declare a symbol should be linked into
static binary.
2006-01-10 04:53:03 +00:00
davidxu
36bb818343 Rescue pthread_set_name_np for compatible reason, remove unused code. 2006-01-09 08:07:22 +00:00
davidxu
8798f9bcec Tweak macro THR_LOCK_RELEASE a bit for non-PTHREAD_INVARIANTS case. 2006-01-09 07:32:22 +00:00
davidxu
db9594be6e Return real detached state. 2006-01-09 03:59:51 +00:00
davidxu
6f27a53b6f Fix a bug recently introduced, the _thread_active_count should be
decreased if thread can not be created.
2006-01-08 10:13:18 +00:00
davidxu
d1f7b6d605 Allow background threads to be suspended. 2006-01-08 01:49:31 +00:00
davidxu
4c4f339838 Try to reduce total time needed for suspending all threads,
first broadcast signals to all threads, then enter a wait loop.
2006-01-08 01:48:51 +00:00
davidxu
f04292bb19 Remove functions i386_get_gsbase and i386_set_gsbase, they were already
in libc.
2006-01-07 06:01:43 +00:00
davidxu
d6c88c0f27 Refine thread suspension code, now thread suspension is a blockable
operation, the caller is blocked util target threads are really
suspended, also avoid suspending a thread when it is holding a
critical lock.
Fix a bug in _thr_ref_delete which tests a never set flag.
2006-01-05 13:51:22 +00:00
davidxu
45180066f9 1. Add SIGEV_THREAD notification for mq_notify.
2. Reuse current timer code and abstract some common code to
   to support both timer and mqueue.
2006-01-04 11:48:02 +00:00
davidxu
46ad9344c2 Remove in-progress wait code to sync with libpthread's behavior. 2006-01-03 13:30:23 +00:00
davidxu
2d34e45c94 Let _mutex_cv_lock call internal functiona mutex_lock_common. 2005-12-21 05:14:07 +00:00
davidxu
5ac55e9c46 Hide umtx API symbols as well. 2005-12-21 03:53:29 +00:00
davidxu
8d9e23fb51 1. Retire macro SCLASS, instead simply use language keyword and
put variables in thr_init.c.
2. Hide all global symbols which won't be exported.
2005-12-21 03:14:06 +00:00
davidxu
3e60ee73cb Follow the mistake in libpthread, the first version name in libpthread
is LIBTHREAD_1_0, but really it should be LIBPTHREAD_1_0.
Fix it so libmap.conf works again (it was broken by recent versioning
code in rtld_elf).
2005-12-21 02:34:20 +00:00
davidxu
a8cc7e07c2 Clear return code to zero if joiner successfully waited joinee.
Bug reported by: jasone at connonware when using ports lang/onyx
MFC after: 3 days
2005-12-19 03:20:55 +00:00
davidxu
272f64aa70 Update copyright. 2005-12-17 09:42:45 +00:00
davidxu
7bdde27518 Remove unused _get_curthread() call. 2005-12-12 07:14:57 +00:00
davidxu
ae161ac239 Fix name compatible problem with POSIX standard. the sigval_ptr and
sigval_int really should be sival_ptr and sival_int.
Also sigev_notify_function accepts a union sigval value but not a
pointer.
2005-11-04 09:41:00 +00:00
davidxu
3e97a4d0bd Remove a redundant _get_curthread() call. 2005-11-02 14:06:29 +00:00
davidxu
e623529523 In raise(), use a shortcut to directly send signal to current thread. 2005-11-02 13:52:48 +00:00
davidxu
326dbaf282 Fix some comments, eliminate a memory leak. 2005-11-01 13:05:47 +00:00
davidxu
e3fd454017 Use TIMERS_UNLOCK. 2005-11-01 07:05:32 +00:00
davidxu
185b13c547 Add code to handle timer_delete(). The timer wrapper code is completely
rewritten, now timers created with same sigev_notify_attributes will
run in same thread, this allows user to organize which timers can
run in same thread to save some thread resource.
2005-11-01 06:53:22 +00:00
davidxu
363ab5c566 Add thread exit handler in timer_loop to handle broken buggy code which
could lead to memory leak.
2005-10-30 23:59:01 +00:00
davidxu
77f9fea7ac Add timer_create wrapper. 2005-10-30 03:16:30 +00:00
davidxu
2039945090 Remove unused variable.
Reviewed by: cognet
2005-10-29 13:40:31 +00:00
davidxu
3882c07f39 Kill unused variable declaration. 2005-10-29 03:08:43 +00:00
davidxu
912a374cd0 Link libthr to libpthread on Alpha and Sparc. 2005-10-27 10:21:23 +00:00
davidxu
3aca9ad9f9 Add experiment code to implement POSIX timer's SIGEV_THREAD notification. 2005-10-26 11:08:32 +00:00
davidxu
0929747005 Follow the change in kernel, joiner thread just waits at thread id
address, let kernel wake it up.
2005-10-26 07:11:43 +00:00
davidxu
108506206f Put pthread_condattr_init sorted order. 2005-10-25 00:09:58 +00:00
davidxu
841a0c67c5 Export following functions:
_pthread_mutexattr_getpshared
	_pthread_mutexattr_setpshared
	pthread_condattr_getpshared
	pthread_condattr_setpshared
	pthread_mutexattr_getpshared
	pthread_mutexattr_setpshared
2005-10-24 05:20:04 +00:00
davidxu
f8a456fe19 Add functions pthread_mutexattr_setpshared and pthread_mutexattr_getpshared. 2005-10-24 05:16:41 +00:00
davidxu
f24893fc40 The pthread_attr_set_createsuspend_np was broken, fix it by
replacing THR_FLAGS_SUSPENDED with THR_FLAGS_NEED_SUSPEND.
2005-10-10 12:15:07 +00:00
davidxu
424c2c3a12 Sort function names. 2005-10-04 08:28:46 +00:00
davidxu
6459dc5d9d Add function pthread_timedjoin_np, the function is similar with pthread_join
except the function will return ETIMEDOUT if target thread does not exit
before specified absolute time passes.
2005-10-04 06:15:25 +00:00
stefanf
be47cc4f82 Include needed headers that were obtained through <pthread.h>. Sort headers
while here.
2005-09-01 15:21:23 +00:00
stefanf
cb1c3eea78 - Prefix MUTEX_TYPE_MAX with PTHREAD_ to avoid namespace pollution.
- Remove the macros MUTEX_TYPE_FAST and MUTEX_TYPE_COUNTING_FAST.

OK'ed by:	deischen
2005-08-19 21:31:42 +00:00
deischen
a1a323c7ed Add usleep to the map files.
Noticed by:	davidxu
2005-08-03 01:54:52 +00:00
deischen
6f4c090af6 Add a cancellation point for usleep().
While here, fix sleep() so that it is also a cancellation point (a
missing weak reference prevented that).
2005-08-03 00:47:31 +00:00
davidxu
dc3be45bb9 Cast to uintptr_t to avoid compiler warning, it was broken by
the recent atomic_ptr() change.
2005-07-28 03:34:54 +00:00
kensmith
f97f77429f Bump the shared library version number of all libraries that have not
been bumped since RELENG_5.

Reviewed by:	ru
Approved by:	re (not needed for commit check but in principle...)
2005-07-22 17:19:05 +00:00
davidxu
4a65a73e58 Fix off-by-one nanosecond bug in macro TIMESPEC_ADD.
Reviewed by: deischen
Approved by: re (dwhite)
MFC after  : 4 days
2005-06-22 22:38:56 +00:00
ru
7cec114952 Markup fixes.
Approved by:	re
2005-06-16 19:01:07 +00:00
rwatson
cbb1ab3809 Remove incorrect BUGS entry: libthr does support process-scope thread
scheduling.

MFC after:	1 week
Submitted by:	davidxu
Approved by:	re (scottl)
2005-06-15 15:21:10 +00:00
rwatson
dffb6088ac Add a stub libthr(3) man page to document what it is and why, as well as
to point at libmap.conf(5).  This will help answer questions about what
and why it is, although not in great detail.

Approved by:	re (scottl)
MFC after:	1 week
MFC note:	When MFC'd, don't MFC mention of work not yet MFC'd.
2005-06-11 15:27:56 +00:00
davidxu
094168eea8 Remove COMPAT_32BIT, it is no longer needed. 2005-04-27 01:29:03 +00:00
davidxu
9f7f211673 Remove unused variable. 2005-04-23 03:34:43 +00:00
davidxu
8d38949442 Now libthr only uses GDT based tls on i386. using LDT can only increase
clock cycles and has 8191 threads limitation.
2005-04-23 03:31:59 +00:00
davidxu
a0a25ee25d Use thr_new syscall to create a new thread, obscure context operations
is no longer needed.
2005-04-23 02:48:59 +00:00
davidxu
d75a2adc3f Add i386_get_gsbase, i386_set_gsbase since old libc doesn't have the
functions, otherwise user ports have to be rebuilt.
2005-04-23 02:14:38 +00:00
peter
c1d476c931 Adapt the libpthread patch for using i386_set_gsbase() to libthr. 2005-04-14 00:44:07 +00:00
davidxu
3093d067e4 Conditionally report initial thread event. 2005-04-12 03:13:49 +00:00
davidxu
bc36c64c8d Add missing event reporting code. 2005-04-12 03:08:11 +00:00
davidxu
2cf5eeb001 Add debugger event reporting support, current only TD_CREATE and TD_DEATH
events are reported.
2005-04-12 03:00:28 +00:00
cognet
c7b04f713a Use the new atomic_cmpset_32(). 2005-04-07 22:06:05 +00:00
davidxu
22b6b1a4cf Adjust hash function for smaller pthread structure size. 2005-04-07 06:09:17 +00:00
davidxu
ed60415691 Remove unique id field which is no longer used by debugger. 2005-04-06 13:57:31 +00:00
davidxu
a991e5caf8 Remove debug symbol from installed library, one can always
use compiled version in libthr directory.
2005-04-06 13:48:11 +00:00
davidxu
1b586b1fd5 Pass exact number of threads. 2005-04-04 23:43:53 +00:00
davidxu
399fdd028a Export pthread_condattr_getclock, pthread_condattr_setclock. 2005-04-03 23:52:29 +00:00
davidxu
f066519e91 Import my recent 1:1 threading working. some features improved includes:
1. fast simple type mutex.
 2. __thread tls works.
 3. asynchronous cancellation works ( using signal ).
 4. thread synchronization is fully based on umtx, mainly, condition
    variable and other synchronization objects were rewritten by using
    umtx directly. those objects can be shared between processes via
    shared memory, it has to change ABI which does not happen yet.
 5. default stack size is increased to 1M on 32 bits platform, 2M for
    64 bits platform.
As the result, some mysql super-smack benchmarks show performance is
improved massivly.

Okayed by: jeff, mtm, rwatson, scottl
2005-04-02 01:20:00 +00:00
marcus
a424dc9347 Increase the default stacksizes:
32-bit		64-bit
main thread	2 MB		4 MB
other threads	1 MB		2 MB

Approved by:	mtm
Adapted from:	libpthread
2005-03-06 07:56:18 +00:00
peter
5d3a1b43b0 Fix inverted #ifdef that I added. Who had the pointy hat last?
Submitted by:  kan
2004-12-06 20:41:09 +00:00
das
130bed6547 Don't include sys/user.h merely for its side-effect of recursively
including other headers.
2004-11-27 06:51:39 +00:00
peter
6185c69a2b Use the recently exposed fs/gs set functions when compiling libthr to
run as a 32 bit support library for an amd64 kernel.  32 bit consumers of
libthr have zero chance of running on an amd64 kernel since we don't
implement the i386_set_ldt() family of functions.  Note that this commit
doesn't make it actually work, it just removes one more obstacle.
2004-11-06 03:30:53 +00:00
ru
5db2b9d5b3 For variables that are only checked with defined(), don't provide
any fake value.
2004-10-24 15:33:08 +00:00
mtm
ce193bdc46 1. Now that it's a thread's state is changed from within the kernel, where
no userland locks are heald, the dead thread lock can no longer protect
   access to it. Therefore, instead of using an if (!dead)...else clause
   after walking the active threads list test the thread pointer before
   deciding not to walk the dead threads list. If the thread pointer is null
   it means it was not found in the active threads list and the dead threads
   list should be checked.

2. Do not free the stack of a thread that is not marked dead. This is the
   2nd and final part of eliminating the race to free a thread's stack.

MFC after: 3 days
2004-10-13 11:42:20 +00:00
mtm
9c7869cb6f Remove a reference to a non-existent syscall: _thr_exit(). The
actual name is thr_exit(). How this ever worked is beyond me.
2004-10-08 14:48:02 +00:00