David Xu
6f79c82641
Set default contention scope to system.
2006-03-20 03:14:14 +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
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
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
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
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
David Xu
c3d1b896b2
Add functions pthread_mutexattr_setpshared and pthread_mutexattr_getpshared.
2005-10-24 05:16:41 +00:00
David Xu
88676cbc2c
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
David Xu
9e49a2370c
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
Stefan Farfeleder
7e4cbc3a50
Include needed headers that were obtained through <pthread.h>. Sort headers
...
while here.
2005-09-01 15:21:23 +00:00
Stefan Farfeleder
ad7c49168f
- 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
Daniel Eischen
14d5987375
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
David Xu
2ff77b9220
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
David Xu
3adc17c503
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
David Xu
80c9676e8b
Use thr_new syscall to create a new thread, obscure context operations
...
is no longer needed.
2005-04-23 02:48:59 +00:00