aboutsummaryrefslogtreecommitdiff
path: root/lib/libpthread/thread
Commit message (Collapse)AuthorAgeFilesLines
* This commit was manufactured by cvs2svn to create tagrelease/6.0.0_cvscvs2svn2005-11-03111-111/+111
| | | | | | 'RELENG_6_0_0_RELEASE'. This commit was manufactured to restore the state of the 6.0-RELEASE image.
* MFC (by deischen)Xin LI2005-10-081-1/+16
| | | | | | | | | | | | | | Add a cancellation point for usleep(). | | Revision Changes Path | 1.9 +16 -1 src/lib/libpthread/thread/thr_sleep.c Approved by: re (kensmith) Ok'ed by: deischen, davidxu Notes: svn path=/stable/6/; revision=151096
* Fix off-by-one nanosecond in macro TIMESPEC_ADD.David Xu2005-06-221-1/+1
| | | | | | | | | Reviewed by: deischen Approved by: re (dwhite) MFC after : 4 days Notes: svn path=/head/; revision=147533
* Somewhere along the line, tick accumulation for SA threads wasDaniel Eischen2005-02-181-1/+1
| | | | | | | | | | changed to use the statclock. Make sure we calculate the value of a tick correctly in userland. Noticed by: Kazuaki Oda <kaakun at highway dot ne dot jp> Notes: svn path=/head/; revision=142047
* Set the default guardsize and stacksize in the default threadDaniel Eischen2005-02-151-0/+2
| | | | | | | attribute when the library is initialized. Notes: svn path=/head/; revision=141949
* Increase the default stacksizes:Daniel Eischen2005-02-134-9/+22
| | | | | | | | | 32-bit 64-bit main thread 2MB 4MB other threads 1MB 2MB Notes: svn path=/head/; revision=141822
* Don't panic when sigsuspend is interrupted by a cancellation.Daniel Eischen2004-12-191-2/+7
| | | | | | | PR: 75273 Notes: svn path=/head/; revision=139052
* Use a generic way to back threads out of wait queues when handlingDaniel Eischen2004-12-1815-347/+410
| | | | | | | | | | | | | | | | | | | | | | | | | | | | signals instead of having more intricate knowledge of thread state within signal handling. Simplify signal code because of above (by David Xu). Use macros for libpthread usage of pthread_cleanup_push() and pthread_cleanup_pop(). This removes some instances of malloc() and free() from the semaphore and pthread_once() implementations. When single threaded and forking(), make sure that the current thread's signal mask is inherited by the forked thread. Use private mutexes for libc and libpthread. Signals are deferred while threads hold private mutexes. This fix also breaks www/linuxpluginwrapper; a patch that fixes it is at http://people.freebsd.org/~deischen/kse/linuxpluginwrapper.diff Fix race condition in condition variables where handling a signal (pthread_kill() or kill()) may not see a wakeup (pthread_cond_signal() or pthread_cond_broadcast()). In collaboration with: davidxu Notes: svn path=/head/; revision=139023
* Save cancelflags in signal frame, this fixes a problem thatDavid Xu2004-11-012-0/+3
| | | | | | | | | | a thread in pthread_cond_wait handled a signal can no longer be canceled. Reviewed by: deischen Notes: svn path=/head/; revision=137105
* Make pthread_mutex_trylock(3) return EBUSY on failure, as all softwareBrian Feldman2004-10-311-8/+1
| | | | | | | | | | | | packages expect and seems to be most correct according to the slightly- ambiguous standards. MFC after: 1 month Corroborated by: POSIX <http://tinyurl.com/4uvub> Reviewed by: silence on threads@ Notes: svn path=/head/; revision=137095
* Check unhandled signals before thread marks itself as DEAD,David Xu2004-10-231-1/+14
| | | | | | | | this reduces chances of signal losting problem found by Peter Holm <peter@holm.cc> Notes: svn path=/head/; revision=136847
* 1. Move thread list flags into new separate member, and atomicallyDavid Xu2004-10-235-24/+45
| | | | | | | | | | | | | | put DEAD thread on GC list, this closes a race between pthread_join and thr_cleanup. 2. Introduce a mutex to protect tcb initialization, tls allocation and deallocation code in rtld seems no lock protection or it is broken, under stress testing, memory is corrupted. Reviewed by: deischen patch partly provided by: deischen Notes: svn path=/head/; revision=136846
* Decrease reference count if we won't use the thread, this avoids memoryDavid Xu2004-10-211-0/+4
| | | | | | | leak under some cases. Notes: svn path=/head/; revision=136735
* if system scope thread didn't set timeout, don't call clock_gettime syscallDavid Xu2004-10-081-8/+9
| | | | | | | | | before and after sleeping. Reviewed by: deischen Notes: svn path=/head/; revision=136286
* Use PTHREAD_SCOPE_SYSTEM to decide what should be done.David Xu2004-10-071-3/+2
| | | | Notes: svn path=/head/; revision=136227
* Follow kernel change, restore signal mask correctly by using a commandDavid Xu2004-10-071-21/+17
| | | | | | | of kse_thr_interrupt. Notes: svn path=/head/; revision=136223
* Allocate red zone and stack space together and then split red zone fromDavid Xu2004-10-061-7/+17
| | | | | | | | allocated space, orignal code left red zone unallocated, but those space can be allocated by user code, and result was providing no protection. Notes: svn path=/head/; revision=136190
* Add a wrapper for execve(). The exec'd process must be started withDaniel Eischen2004-09-262-0/+69
| | | | | | | | | | | | | | | | | the signal mask and pending signals of the calling thread. These are stored in userland in libpthread. There is a small race condition in this patch which could cause problems if a signal arrives after setting the (kernel) signal mask and before exec'ing. The thread's set of pending signals also are not yet installed in the exec'd process. Both of these will be corrected with the addition of a special syscall. Reported & Tested by: Joost Bekkers <joost at jodocus dot org> Reviewed by: julian, davidxu Notes: svn path=/head/; revision=135809
* Make sure we don't call _thr_start_sig_daemon() when SYSTEM_SCOPE_ONLY is ↵Suleiman Souhlal2004-09-241-2/+3
| | | | | | | | | defined. This makes libpthread usable on powerpc. Approved by: grehan (mentor), deischen Notes: svn path=/head/; revision=135714
* Pull debug symbols in for statically linked binary.David Xu2004-08-211-0/+4
| | | | | | | Reviewed by: desichen Notes: svn path=/head/; revision=134115
* 1. Add macro DTV_OFFSET to calculate dtv offset in tcb.David Xu2004-08-161-0/+1
| | | | | | | 2. Export symbols needed by debugger. Notes: svn path=/head/; revision=133801
* Add a file to collection all symbols will be needed by debugger.David Xu2004-08-161-0/+60
| | | | Notes: svn path=/head/; revision=133800
* Add TLS support for i386 and amd64.Doug Rabson2004-08-151-1/+1
| | | | Notes: svn path=/head/; revision=133756
* As long as we have a knob to force system scope threads, why not haveDaniel Eischen2004-08-124-8/+13
| | | | | | | | | | | | | | | | a knob to force process scope threads. If the environment variable LIBPTHREAD_PROCESS_SCOPE is set, force all threads to be process scope threads regardless of how the application creates them. If LIBPTHREAD_SYSTEM_SCOPE is set (forcing system scope threads), it overrides LIBPTHREAD_PROCESS_SCOPE. $ # To force system scope threads $ LIBPTHREAD_SYSTEM_SCOPE=anything threaded_app $ # To force process scope threads $ LIBPTHREAD_PROCESS_SCOPE=anything threaded_app Notes: svn path=/head/; revision=133563
* Check debugger suspending flag for system scope thread.David Xu2004-08-081-3/+7
| | | | | | | Reviewed by: deischen Notes: svn path=/head/; revision=133344
* Add a way to force 1:1 mode for libpthread. To do this, defineDaniel Eischen2004-08-075-42/+41
| | | | | | | | | | | | | | LIBPTHREAD_SYSTEM_SCOPE in the environment. You can still force libpthread to be built in strictly 1:1 by adding -DSYSTEM_SCOPE_ONLY to CFLAGS. This is kept for archs that don't yet support M:N mode. Requested by: rwatson Reviewed by: davidxu Notes: svn path=/head/; revision=133269
* s/TMDF_DONOTRUNUSER/TMDF_SUSPEND/gDavid Xu2004-08-033-4/+4
| | | | | | | Dicussed with: deischen Notes: svn path=/head/; revision=133047
* Don't include lock.h and pthread_md.h when we're being included byMarcel Moolenaar2004-07-181-0/+2
| | | | | | | libthread_db. Both headers are included seperately. Notes: svn path=/head/; revision=132333
* Remove unused symbols.David Xu2004-07-131-14/+0
| | | | Notes: svn path=/head/; revision=132124
* Let debugger check signal, make SIGINFO works.David Xu2004-07-131-12/+25
| | | | Notes: svn path=/head/; revision=132122
* If _libkse_debug is not zero, activate thread mode.David Xu2004-07-131-0/+6
| | | | Notes: svn path=/head/; revision=132121
* Add code to support thread debugging.David Xu2004-07-135-44/+146
| | | | | | | | | | | | | | | | | | 1. Add global varible _libkse_debug, debugger uses the varible to identify libpthread. when the varible is written to non-zero by debugger, libpthread will take some special action at context switch time, it will check TMDF_DOTRUNUSER flags, if a thread has the flags set by debugger, it won't be scheduled, when a thread leaves KSE critical region, thread checks the flag, if it was set, the thread relinquish CPU. 2. Add pq_first_debug to select a thread allowd to run by debugger. 3. Some names prefixed with _thr are renamed to _thread prefix. which is allowed to run by debugger. Notes: svn path=/head/; revision=132120
* Check pending signals, if there is signal will be unblocked byDavid Xu2004-06-124-22/+25
| | | | | | | | | | | | | | | | | | | | | sigsuspend, thread shouldn't wait, in old code, it may be ignored. When a signal handler is invoked in sigsuspend, thread gets two different signal masks, one is in thread structure, sigprocmask() can retrieve it, another is in ucontext which is a third parameter of signal handler, the former is the result of sigsuspend mask ORed with sigaction's sa_mask and current signal, the later is the mask in thread structure before sigsuspend is called. After signal handler is called, the mask in ucontext should be copied into thread structure, and becomes CURRENT signal mask, then sigsuspend returns to user code. Reviewed by: deischen Tested by: Sean McNeil <sean@mcneil.com> Notes: svn path=/head/; revision=130374
* After forking and initializing the library to single-threadedDaniel Eischen2004-04-081-2/+3
| | | | | | | | | | | | | mode (where the forked thread is the one and only thread and is marked as system scope), set the system scope flag before initializing the signal mask. This prevents trying to use internal locks that haven't yet been initialized. Reported by: Dan Nelson <dnelson at allantgroup.com> Reviewed by: davidxu Notes: svn path=/head/; revision=128041
* Fix a POSIX conformance bug. POSIX says sigwait should return error numberDavid Xu2004-03-171-3/+3
| | | | | | | in return value not in errno. Notes: svn path=/head/; revision=127102
* Fixed a misspelling of 0 as NULL.Bruce Evans2004-03-141-1/+1
| | | | Notes: svn path=/head/; revision=126952
* style cleanup: Remove duplicate $FreeBSD$ tags.Colin Percival2004-02-101-2/+0
| | | | | | | | | | | These files had tags after the copyright notice, inside the comment block (incorrect, removed), and outside the comment block (correct). Approved by: rwatson (mentor) Notes: svn path=/head/; revision=125668
* Add cancellation point to sem_wait() and sem_timedwait() for psharedDaniel Eischen2004-02-061-10/+18
| | | | | | | | | | | semaphores. Also add cancellation cleanup handlers to keep semaphores in a consistent state. Submitted in part by: davidxu Reviewed by: davidxu Notes: svn path=/head/; revision=125522
* Provide a userland version of non-pshared semaphores and add cancellationDaniel Eischen2004-02-032-169/+153
| | | | | | | points to sem_wait() and sem_timedwait(). Also make sem_post signal-safe. Notes: svn path=/head/; revision=125373
* Return EPERM if mutex owner is not current thread but it tries toDavid Xu2004-01-171-18/+3
| | | | | | | | | unlock the mutex, old code confuses some programs when it returns EINVAL. Noticed by: bland Notes: svn path=/head/; revision=124606
* Add a simple work-around for deadlocking on recursive read locksDaniel Eischen2004-01-083-48/+86
| | | | | | | | | | | | | on a rwlock while there are writers waiting. We normally favor writers but when a reader already has at least one other read lock, we favor the reader. We don't track all the rwlocks owned by a thread, nor all the threads that own a rwlock -- we just keep a count of all the read locks owned by a thread. PR: 24641 Notes: svn path=/head/; revision=124252
* Kernel now supports per-thread sigaltstack, follow the change toDavid Xu2004-01-031-6/+1
| | | | | | | enable sigaltstack for scope system thread. Notes: svn path=/head/; revision=124095
* Return error code in errno, not in return value.David Xu2004-01-021-3/+6
| | | | Notes: svn path=/head/; revision=124056
* Fix a typo.David Xu2004-01-021-1/+1
| | | | Notes: svn path=/head/; revision=124055
* Forgot to commit this file for last commit. :(David Xu2003-12-291-0/+4
| | | | Notes: svn path=/head/; revision=123975
* Implement sigaltstack() as per-threaded. Current only scope process threadDavid Xu2003-12-294-24/+231
| | | | | | | | | | | is supported, for scope system process, kernel signal bits need to be changed. Reviewed by: deischen Tested on : i386 amd64 ia64 Notes: svn path=/head/; revision=123974
* Correctly retrieve sigaction flags.David Xu2003-12-281-2/+2
| | | | Notes: svn path=/head/; revision=123933
* Replace a comment with more accurated one, memory heap is now protected byDavid Xu2003-12-191-3/+2
| | | | | | | new fork() wrapper. Notes: svn path=/head/; revision=123668
* Code clean up, remove unused MACROS and function prototypes.David Xu2003-12-191-18/+0
| | | | Notes: svn path=/head/; revision=123666
* accept() returns a file descriptor when it succeeds which is veryDaniel Eischen2003-12-092-2/+2
| | | | | | | | | | | | likely to be non-zero. When leaving the cancellation point, check the return value against -1 to see if cancellation should be checked. While I'm here, make the same change to connect() just to be consisitent. Pointed out by: davidxu Notes: svn path=/head/; revision=123365