davidxu
52bd1282cd
Output error message to STDERR_FILENO.
...
Approved by: re (bmah)
2007-08-07 04:50:14 +00:00
davidxu
d97c4f1e52
backout experimental adaptive spinning mutex for product use.
2007-05-09 08:39:33 +00:00
davidxu
2dd85eafce
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
imp
9109b1ceb8
Remove 3rd clause, renumber, ok per email
2007-01-12 07:26:21 +00:00
davidxu
9770c4c640
Insert mutex at tail if it has highest ceiling.
2007-01-05 03:57:11 +00:00
davidxu
dec2b546dd
Oops, don't corrupt the list.
2007-01-05 03:33:47 +00:00
davidxu
190109deab
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
davidxu
d305995d66
get LIBPTHREAD_ADAPTIVE_SPIN early, so it can be used for some global
...
mutexes.
2006-12-20 05:05:44 +00:00
davidxu
e034ab54f2
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
davidxu
ca27871833
- 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
davidxu
26cbb63b3f
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
davidxu
229aca4634
Correctly check failed syscall.
2006-12-12 05:26:39 +00:00
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
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
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
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
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
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