Jason Evans
b6b7fd3e2a
Fix pointer dereferencing problems in _pthread_mutex_init_calloc_cb() that
...
were obscured by pseudo-opaque pthreads API pointer casting.
2007-11-28 00:16:24 +00:00
Jason Evans
e1636e1f97
Add _pthread_mutex_init_calloc_cb() to libthr and libkse, so that malloc(3)
...
(part of libc) can use pthreads mutexes without causing infinite recursion
during initialization.
2007-11-27 03:16:44 +00:00
David Xu
da4410f25f
Simplify code, fix a thread cancellation bug in sem_wait and sem_timedwait.
2007-11-23 05:42:52 +00:00
David Xu
4877aaebc1
Reuse nwaiter member field to record number of waiters, in sem_post(),
...
this should reduce the chance having to do a syscall when there is no
waiter in the semaphore.
2007-11-21 06:01:02 +00:00
David Xu
73ba600faa
Remove warning level and aliasing restrictions.
2007-11-21 05:29:57 +00:00
David Xu
9e1ddd5fa0
Convert ceiling type to unsigned integer before comparing, fix compiler
...
warnings.
2007-11-21 05:25:27 +00:00
David Xu
922d56f9de
Add some function prototypes.
2007-11-21 05:23:54 +00:00
David Xu
6fdfcacb4a
Remove umtx_t definition, use type long directly, add wrapper function
...
_thr_umtx_wait_uint() for umtx operation UMTX_OP_WAIT_UINT, use the
function in semaphore operations, this fixed compiler warnings.
2007-11-21 05:21:58 +00:00
John Birrell
0aad0f2282
These are the things that the tinderbox has problems with because it
...
doesn't use the default CFLAGS which contain -fno-strict-aliasing.
Until the code is cleaned up, just add -fno-strict-aliasing to the
CFLAGS of these for the tinderboxes' sake, allowing the rest of the
tree to have -Werror enabled again.
2007-11-20 02:07:30 +00:00
Marius Strobl
9a2706abcc
In _pthread_key_create() ensure that libthr is initialized. This
...
fixes a NULL-dereference of curthread when libstdc+ initializes
the exception handling globals on archs we can't use GNU TLS due
to lack of support in binutils 2.15 (i.e. arm and sparc64), yet,
thus making threaded C++ programs compiled with GCC 4.2.1 work
again on these archs.
Reviewed by: davidxu
MFC after: 3 days
2007-11-06 21:50:43 +00:00
David Xu
56b45d9067
Avoid doing adaptive spinning for priority protected mutex, current
...
implementation always does lock in kernel.
2007-10-31 01:50:48 +00:00
David Xu
55f18e070f
Don't do adaptive spinning if it is running on UP kernel.
2007-10-31 01:44:50 +00:00
David Xu
e8ef3c283b
Restore revision 1.55, the kris's adaptive mutex type.
2007-10-31 01:37:13 +00:00
Kris Kennaway
83941f797f
Adaptive mutexes should have the same deadlock detection properties that
...
default (errorcheck) mutexes do.
Noticed by: davidxu
2007-10-30 09:24:23 +00:00
David Xu
7416cdabcd
Add my recent work of adaptive spin mutex code. Use two environments variable
...
to tune pthread mutex performance:
1. LIBPTHREAD_SPINLOOPS
If a pthread mutex is being locked by another thread, this environment
variable sets total number of spin loops before the current thread
sleeps in kernel, this saves a syscall overhead if the mutex will be
unlocked very soon (well written application code).
2. LIBPTHREAD_YIELDLOOPS
If a pthread mutex is being locked by other threads, this environment
variable sets total number of sched_yield() loops before the currrent
thread sleeps in kernel. if a pthread mutex is locked, the current thread
gives up cpu, but will not sleep in kernel, this means, current thread
does not set contention bit in mutex, but let lock owner to run again
if the owner is on kernel's run queue, and when lock owner unlocks the
mutex, it does not need to enter kernel and do lots of work to resume
mutex waiters, in some cases, this saves lots of syscall overheads for
mutex owner.
In my practice, sometimes LIBPTHREAD_YIELDLOOPS can massively improve performance
than LIBPTHREAD_SPINLOOPS, this depends on application. These two environments
are global to all pthread mutex, there is no interface to set them for each
pthread mutex, the default values are zero, this means spinning is turned off
by default.
2007-10-30 05:57:37 +00:00
Kris Kennaway
2017a7cdfe
Add a new "non-portable" mutex type, PTHREAD_MUTEX_ADAPTIVE_NP. This
...
is also implemented in glibc and is used by a number of existing
applications (mysql, firefox, etc).
This mutex type is a default mutex with the additional property that
it spins briefly when attempting to acquire a contested lock, doing
trylock operations in userland before entering the kernel to block if
eventually unsuccessful.
The expectation is that applications requesting this mutex type know
that the mutex is likely to be only held for very brief periods, so it
is faster to spin in userland and probably succeed in acquiring the
mutex, than to enter the kernel and sleep, only to be woken up almost
immediately. This can help significantly in certain cases when
pthread mutexes are heavily contended and held for brief durations
(such as mysql).
Spin up to 200 times before entering the kernel, which represents only
a few us on modern CPUs. No performance degradation was observed with
this value and it is sufficient to avoid a large performance drop in
mysql performance in the heavily contended pthread mutex case.
The libkse implementation is a NOP.
Reviewed by: jeff
MFC after: 3 days
2007-10-29 21:01:47 +00:00
Ruslan Ermilov
886659fe14
- Stop calling libthr alternative as it's now the default
...
threading library.
- Now that libpthread is a symlink, it's no longer possible
to link applications with libpthread and have libmap.conf(5)
select the desired threading library; applications will be
linked to the default threading library, libkse or libthr.
Remove an obsolete paragraph.
- Mention that improvements can be seen compared to libkse.
Reviewed by: deischen, davidxu
2007-10-22 10:13:38 +00:00
David Xu
5150e987d2
Use macro THR_CLEANUP_PUSH/POP, they are cheaper than pthread_cleanup_push/pop.
2007-10-16 07:46:15 +00:00
David Xu
286b41104d
Reverse the logic of UP and SMP.
...
Submitted by: jasone
2007-10-16 07:36:02 +00:00
David E. O'Brien
946367b8e2
Tweak the handling of "WITHOUT_LIBPTHREAD". Also remove the accidental
...
treatment of 'LIBKSE' as an "old style" knob.
Submitted by: ru
Approved by: re(kensmith)
2007-10-09 23:31:11 +00:00
Ruslan Ermilov
948809b1ae
Always install libpthread.* symlinks if at least one of
...
the threading libraries is built. This simplifies the
logic in makefiles that need to check if the pthreads
support is present. It also fixes a bug where we would
build a threading library that we shouldn't have built:
for example, building with WITHOUT_LIBTHR and the default
value of DEFAULT_THREADING_LIB (libthr) would mistakenly
build the libthr library, but not install it.
Approved by: re (kensmith)
2007-10-01 18:29:55 +00:00
David Xu
4aa80591b6
Output error message to STDERR_FILENO.
...
Approved by: re (bmah)
2007-08-07 04:50:14 +00:00
David Xu
44a31c2d7f
Set warning level to 2.
2007-06-08 02:21:13 +00:00
Daniel Eischen
419ecd5dee
Bump library versions in preparation for 7.0.
...
Ok'd by: kan
2007-05-21 02:49:08 +00:00
Ruslan Ermilov
539e7a7770
Fix a logic bug I re-introduced in my patch I sent to Daniel
...
that would cause the selected shared threading library to be
overwritten with its 32-bit version on amd64.
PR: amd64/112509
2007-05-18 12:25:48 +00:00
Daniel Eischen
683f4c0a40
Allow DEFAULT_THREAD_LIB to be set from /etc/src.conf.
...
Submitted by: ru
2007-05-17 04:54:35 +00:00
Daniel Eischen
00fb440c1a
Enable symbol versioning by default. Use WITHOUT_SYMVER to disable it.
...
Warning, after symbol versioning is enabled, going back is not easy
(use WITHOUT_SYMVER at your own risk).
Change the default thread library to libthr.
There most likely still needs to be a version bump for at least the
thread libraries. If necessary, this will happen later.
2007-05-13 14:12:40 +00:00
David Xu
00784f8b10
backout experimental adaptive spinning mutex for product use.
2007-05-09 08:39:33 +00:00
Daniel Eischen
5f864214bb
Use C comments since we now preprocess these files with CPP.
2007-04-29 14:05:22 +00:00
David Xu
6839e793cf
If a thread who's name is being set is not the current thread, use macros
...
THR_THREAD_LOCK and THR_THREAD_UNLOCK instead, this should fix wrong
lock level problem.
Bug reported by: ed dot maste at gmail dot com
2007-04-05 07:20:31 +00:00
Warner Losh
fed32d7544
Remove 3rd clause, renumber, ok per email
2007-01-12 07:26:21 +00:00
David Xu
03779e5c2b
Insert mutex at tail if it has highest ceiling.
2007-01-05 03:57:11 +00:00
David Xu
da20a63dbb
Oops, don't corrupt the list.
2007-01-05 03:33:47 +00:00
David Xu
5470bb56fc
Check if the PP mutex is recursive, if we have already locked it, place the
...
mutex in right order sorted by priority ceiling.
2007-01-05 03:29:15 +00:00
David Xu
74c751131b
get LIBPTHREAD_ADAPTIVE_SPIN early, so it can be used for some global
...
mutexes.
2006-12-20 05:05:44 +00:00
David Xu
842a092b74
Check environment variable PTHREAD_ADAPTIVE_SPIN, if it is set, use
...
it as a default spin cycle count.
2006-12-20 04:43:34 +00:00
David Xu
d99f6dac14
- Remove variable _thr_scope_system, all threads are system scope.
...
- Rename _thr_smp_cpus to boolean variable _thr_is_smp.
- Define CPU_SPINWAIT macro for each arch, only X86 supports it.
2006-12-15 11:52:01 +00:00
David Xu
8a8178c010
Create inline function _thr_umutex_trylock2 to only try one atomic
...
operation, if it is failed, we call syscall directly, this saves
one atomic operation per lock contention.
2006-12-14 13:22:02 +00:00
David Xu
9e8a8aa551
Correctly check failed syscall.
2006-12-12 05:26:39 +00:00
David Xu
347126a2e2
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
David Xu
b774466b61
test cancel_pending to save a thr_wake call in some specical cases.
2006-12-06 00:15:35 +00:00
David Xu
a8a343d2e6
_thr_ucond_wait drops lock, we should pick it up again.
2006-12-05 23:46:11 +00:00
David Xu
3b8a017442
the c_has_waiters is lazily updated, temporarily disable the false
...
alarm code.
2006-12-05 07:23:58 +00:00
David Xu
4d617f2d10
Use ucond to implement barrier.
2006-12-05 06:54:25 +00:00
David Xu
670b44d65a
Add _thr_ucond_init().
2006-12-05 06:53:44 +00:00
David Xu
3ce4e91d4e
Tweak _thr_cancel_leave_defer a bit to fix a possible race.
2006-12-05 05:01:57 +00:00
David Xu
3c61d00ab6
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
David Xu
2bd2c90703
Use kernel provided userspace condition variable to implement pthread
...
condition variable.
2006-12-04 14:20:41 +00:00
David Xu
6f54e82927
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
Ruslan Ermilov
8af480aec1
- 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
David Xu
f08e1bf682
Eliminate atomic operations in thread cancellation functions, it should
...
reduce overheads of cancellation points.
2006-11-24 09:57:38 +00:00
David Xu
58c7bab332
Move code calculating new inherited priority into single function.
2006-11-11 13:33:47 +00:00
David Xu
5656b5fafa
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
David Xu
8042f26d52
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
David Xu
0b90fa4ad0
Use type pthread_state for thread state.
2006-10-13 12:45:21 +00:00
David Xu
e6747c7ce1
use rtprio_thread system call to get or set thread priority.
2006-09-21 04:21:30 +00:00
David Xu
ddaf6689e3
Use return value of _thr_umutex_lock instead of using zero.
2006-09-08 09:29:14 +00:00
David Xu
bddd24cd9c
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
David Xu
8549079365
Same as pthread_setschedparam, use sizeof(struct sched_param) instead.
2006-09-05 14:39:06 +00:00
David Xu
be0bfdd207
Pass correct parameter size.
2006-09-05 14:37:22 +00:00
Marcel Moolenaar
be2f4bda88
Stylize: avoid using a global register variable.
2006-09-01 21:01:11 +00:00
Marcel Moolenaar
cc79b334de
Rename TLS_TP_OFFSET back to TP_OFFSET. The former clashes with rtld.
2006-09-01 06:36:00 +00:00
Marcel Moolenaar
8e61dbecfc
Stylize.
2006-09-01 06:15:00 +00:00
Marcel Moolenaar
35ca217bf0
Stylize.
2006-08-31 23:31:18 +00:00
Marcel Moolenaar
9f7b8b0d3c
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 Moolenaar
91705de0c2
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 Moolenaar
57c2251d5c
o Set TP using inline assembly to avoid dead code elimination.
...
o Eliminate _tcb.
2006-08-30 03:31:32 +00:00
David Xu
fd2b89c48c
Remove unused file.
2006-08-29 13:01:23 +00:00
David Xu
215318a7a3
pthread_sigmask is in thr_sig.c, remove this file.
2006-08-28 12:29:54 +00:00
David Xu
6361212beb
Kill unused files.
2006-08-28 05:01:31 +00:00
David Xu
8ab9d78b9d
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
David Xu
cf13ecda6a
Add umutex APIs.
2006-08-28 04:47:27 +00:00
Ruslan Ermilov
2b46c64c9c
Remove alpha left-overs.
2006-08-22 08:03:01 +00:00
David Xu
065dbdc130
Axe unused member field.
2006-08-08 05:04:43 +00:00
David Xu
6b73f08519
Get number of CPUs and ignore spin count on single processor machine.
2006-08-08 04:42:41 +00:00
David Xu
05c3a5eab4
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
Xin LI
da84584390
Unexpand two TAILQ_FOREACH_SAFE cases.
...
Ok'ed by: davidxu
2006-07-17 09:23:44 +00:00
David Xu
e2dc286c1c
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
David Xu
561a89f945
Use thr_setscheduler, thr_getscheduler and thr_setschedparam to implement
...
pthread functions.
2006-07-13 06:35:43 +00:00
David Xu
7b4f8f037f
Use kernel facilities to support real-time scheduling.
2006-07-12 06:13:18 +00:00
David Xu
9bbc6c7f54
__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
David Xu
7fabe0b5cc
Remove unused member.
2006-06-03 00:19:40 +00:00
David Xu
b971a73040
Remove unused member field m_queue.
2006-06-02 08:37:01 +00:00
Xin LI
631574e7dc
Explicitly request pre-zeroed memory instead of memset'ing our
...
own.
Ok'ed by: davidxu
2006-05-31 00:31:38 +00:00
David Xu
e92b415c5a
Add symbol versions: FBSD_1.0 and FBSDprivate.
2006-05-11 07:02:52 +00:00
David Xu
0a5fa45560
s/long/int.
2006-04-27 08:25:13 +00:00
David Xu
245116cafc
- 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
David Xu
d96413eaa4
Remove multiple _get_curthread() calls.
2006-04-23 11:23:37 +00:00
Ruslan Ermilov
84e709f1f1
Install shared libpthread library into /lib; needed by some
...
/sbin programs.
2006-04-12 19:42:20 +00:00
David Xu
a97944597b
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
David Xu
b7e118b1e0
Remove declaration of _thr_initial from MD header file, it is no longer
...
needed.
2006-04-04 03:35:26 +00:00
David Xu
7bd761788d
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
David Xu
37a6356bbe
WARNS level 4 cleanup.
2006-04-04 02:57:49 +00:00
Dag-Erling Smørgrav
552585665b
Fix prototype mismatch.
2006-03-28 21:46:55 +00:00
David Xu
9ad4b64459
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
David Xu
649814dd6c
Comment out -g compiler option, found by 'FreeBSD Build Options Survey'.
2006-03-27 05:58:58 +00:00
David Xu
d448272d3c
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
David Xu
efe33769b9
Don't cancel thread if it is in critical region.
2006-03-25 07:03:13 +00:00
David Xu
f656ae703e
Only wake up writer if the lock is free.
2006-03-25 05:14:21 +00:00
David Xu
07c7c80074
Compile thr_rtld.c
2006-03-25 05:00:54 +00:00
David Xu
b6b894f66b
Add locking support for rtld.
2006-03-25 04:49:07 +00:00
David Xu
c147998f53
set an upper limit for thread structures which can be allocated.
2006-03-24 04:34:06 +00:00
David Xu
6f79c82641
Set default contention scope to system.
2006-03-20 03:14:14 +00:00
Ruslan Ermilov
5740a2b62d
Convert NO_PROFILE and NO_LIB32 to new style.
2006-03-18 21:37:05 +00:00
David Xu
d3de1dcae7
Remove mqueue and timer, now they are in librt.
2006-03-08 23:47:04 +00:00
Daniel Eischen
f4cd2a5b5c
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
David Xu
7b8797d300
Reimplement mutex_init to get rid of compile warning.
2006-02-28 06:06:19 +00:00
David Xu
b620798174
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
David Xu
bab012a948
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
David Xu
6f716c2f82
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
David Xu
c5d2fb8df7
After fork(), reinitialize internal locks for pthread_once().
2006-02-15 13:41:02 +00:00
David Xu
8956297a57
Now, thread name is stored in kernel, userland no longer has to keep it.
2006-02-05 03:04:54 +00:00
David Xu
3f7dda33b7
use syscall thr_set_name to implement pthread_set_name_np.
2006-02-05 02:26:17 +00:00
David Xu
5f9df00649
Add missing symbol pthread_set_name_np.
2006-01-23 06:11:23 +00:00
David Xu
1c9db39d88
Eliminate unused code.
2006-01-16 05:33:48 +00:00
David Xu
add2da0db1
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
Jason Evans
90dc795234
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
Jason Evans
52828c0e9c
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
David Xu
07a263153e
The thr_new sysscall was already in libc, don't generate it.
2006-01-11 06:10:05 +00:00
David Xu
9572a73405
Use macro STATIC_LIB_REQUIRE to declare a symbol should be linked into
...
static binary.
2006-01-10 04:53:03 +00:00
David Xu
e35e2ebd24
Rescue pthread_set_name_np for compatible reason, remove unused code.
2006-01-09 08:07:22 +00:00
David Xu
a53747d8fe
Tweak macro THR_LOCK_RELEASE a bit for non-PTHREAD_INVARIANTS case.
2006-01-09 07:32:22 +00:00
David Xu
4160cda0dc
Return real detached state.
2006-01-09 03:59:51 +00:00
David Xu
1775714935
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
David Xu
23db0a33f7
Allow background threads to be suspended.
2006-01-08 01:49:31 +00:00
David Xu
0d29c148eb
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
David Xu
d827aa478d
Remove functions i386_get_gsbase and i386_set_gsbase, they were already
...
in libc.
2006-01-07 06:01:43 +00:00
David Xu
bc414752d3
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
David Xu
5131df80a5
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
David Xu
97986a2ea0
Remove in-progress wait code to sync with libpthread's behavior.
2006-01-03 13:30:23 +00:00
David Xu
e6262545cf
Let _mutex_cv_lock call internal functiona mutex_lock_common.
2005-12-21 05:14:07 +00:00
David Xu
8429e73473
Hide umtx API symbols as well.
2005-12-21 03:53:29 +00:00
David Xu
cf905a1575
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
David Xu
7a65760923
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
David Xu
597dc824a0
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
David Xu
df2cf82178
Update copyright.
2005-12-17 09:42:45 +00:00
David Xu
e6a9baa280
Remove unused _get_curthread() call.
2005-12-12 07:14:57 +00:00
David Xu
8f0371f19d
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
David Xu
e89510b152
Remove a redundant _get_curthread() call.
2005-11-02 14:06:29 +00:00
David Xu
7f838bf429
In raise(), use a shortcut to directly send signal to current thread.
2005-11-02 13:52:48 +00:00
David Xu
bff49d66ab
Fix some comments, eliminate a memory leak.
2005-11-01 13:05:47 +00:00
David Xu
6cae59b1e7
Use TIMERS_UNLOCK.
2005-11-01 07:05:32 +00:00
David Xu
53bbdf8646
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
David Xu
7a81302ce7
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
David Xu
4a050d016e
Add timer_create wrapper.
2005-10-30 03:16:30 +00:00
David Xu
c09df63bb9
Remove unused variable.
...
Reviewed by: cognet
2005-10-29 13:40:31 +00:00
David Xu
babdcc8d78
Kill unused variable declaration.
2005-10-29 03:08:43 +00:00
David Xu
55ac4c3523
Link libthr to libpthread on Alpha and Sparc.
2005-10-27 10:21:23 +00:00
David Xu
07b6889426
Add experiment code to implement POSIX timer's SIGEV_THREAD notification.
2005-10-26 11:08:32 +00:00
David Xu
d7f119abd5
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