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
David Xu
7a4cd8d366
Conditionally report initial thread event.
2005-04-12 03:13:49 +00:00
David Xu
4faae5e992
Add missing event reporting code.
2005-04-12 03:08:11 +00:00
David Xu
d245d9e13f
Add debugger event reporting support, current only TD_CREATE and TD_DEATH
...
events are reported.
2005-04-12 03:00:28 +00:00
David Xu
62a2d99ce5
Adjust hash function for smaller pthread structure size.
2005-04-07 06:09:17 +00:00
David Xu
bc1eb018c1
Remove unique id field which is no longer used by debugger.
2005-04-06 13:57:31 +00:00
David Xu
619f4fce79
Pass exact number of threads.
2005-04-04 23:43:53 +00:00
David Xu
a091d823ad
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
Joe Marcus Clarke
c5a6625e3e
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
David Schultz
6004362e66
Don't include sys/user.h merely for its side-effect of recursively
...
including other headers.
2004-11-27 06:51:39 +00:00
Mike Makonnen
5dbd7addb0
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
Mike Makonnen
4cdb7f14ed
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
Mike Makonnen
401901ac43
Close a race between a thread exiting and the freeing of it's stack.
...
After some discussion the best option seems to be to signal the thread's
death from within the kernel. This requires that thr_exit() take an
argument.
Discussed with: davidxu, deischen, marcel
MFC after: 3 days
2004-10-06 14:23:00 +00:00