summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread
Commit message (Collapse)AuthorAgeFilesLines
* Repo copy libpthreads to libkse.David E. O'Brien2007-10-09113-18511/+0
| | | | | | | | | This introduces the WITHOUT_LIBKSE nob, and changes WITHOUT_LIBPTHREADS to mean with neither threading libs. Approved by: re(kensmith) Notes: svn path=/head/; revision=172492
* Enable symbol versioning by default. Use WITHOUT_SYMVER to disable it.Daniel Eischen2007-05-131-1/+1
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=169524
* Catch up with the renaming of the private version namespace.Daniel Eischen2007-04-291-1/+1
| | | | Notes: svn path=/head/; revision=169094
* Add a reference and lock the target thread when setting its name.Daniel Eischen2007-04-231-5/+24
| | | | | | | Submitted by: davidxu (via libthr) Notes: svn path=/head/; revision=168964
* Oops, fix a typo in the last commit :-/Brian Somers2007-03-051-1/+1
| | | | Notes: svn path=/head/; revision=167244
* In the NOTYET code path when a process forks, the remainingBrian Somers2007-03-051-7/+4
| | | | | | | | | | | | | | child thread goes back to system scope rather than process scope. This allows an ensuing exec() to actually work. This change was made a year ago here, but I "forgot" to commit it :( Approved by: deischen MFC after: 3 weeks Notes: svn path=/head/; revision=167241
* Remove 3rd clause, renumber, ok per emailWarner Losh2007-01-1257-228/+57
| | | | Notes: svn path=/head/; revision=165967
* Clean bound and non-bound pthread structures consistently beforePeter Edwards2006-12-181-4/+5
| | | | | | | | | | | | | | | they become candidates for reuse. Without this fix, some of the state from a thread structure's previous incarnation could interfere with its new one. Specifically, a non-bound thread started as "suspended" (see pthread_attr_setcreatesuspend_np()) might not get scheduled at all when resumed, as the "active" flag would be set spuriously. Reviewed by: deischen@, davidxu@ MFC after: 1 week Notes: svn path=/head/; revision=165334
* If a thread was detached, return EINVAL instead, the error codeDavid Xu2006-11-281-1/+1
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=164715
* o Remove a cruft prevented libpthread sigaction(2) wrapper toMaxim Konovalov2006-06-093-7/+18
| | | | | | | | | | | | | | | | do its work for SIGINFO. Always install libpthread signal handler wrapper for SIGINFO even if user SIG_IGN's or SIG_DFL's it. SIGINFO has a special meaning for libpthread: when LIBPTHREAD_DEBUG enviroment variable defined it is used for dumping an information about threads to /tmp/. Reported by: mi Reviewed by: deischen MFC after: 2 weeks Notes: svn path=/head/; revision=159462
* Export offsets of thread signal pending set and signal mask for debugger.David Xu2006-05-171-0/+2
| | | | Notes: svn path=/head/; revision=158679
* Unexpand TAILQ_FIRST(foo) == NULL to TAILQ_EMPTY.Xin LI2006-04-132-5/+5
| | | | | | | Ok'ed by: davidxu Notes: svn path=/head/; revision=157700
* Bring libpthread up to WARNS level 2.Dag-Erling Smørgrav2006-03-292-7/+15
| | | | | | | Reviewed by: deischen Notes: svn path=/head/; revision=157243
* Fix prototype mismatch and use of un-namespaced pthread functions.Dag-Erling Smørgrav2006-03-281-11/+7
| | | | Notes: svn path=/head/; revision=157235
* Use the correct type for and argument. Recent changes to namespace.hDaniel Eischen2006-03-281-1/+1
| | | | | | | | | exposed this bug. Reported by: kris Notes: svn path=/head/; revision=157228
* Add compatibility symbol maps. libpthread (.so.1 and .so.2)Daniel Eischen2006-03-13101-1/+485
| | | | | | | | | | | | | | used LIBTHREAD_1_0 as its version definition, but now needs to define its symbols in the same namespace used by libc. The compatibility hooks allows you to use libraries and binaries built and linked to libpthread before libc was built with symbol versioning. The shims can be removed if libpthread is given a version bump. Reviewed by: davidxu Notes: svn path=/head/; revision=156611
* Only catch SIGINFO (for dumping thread states) when LIBPTHREAD_DEBUGDaniel Eischen2006-03-063-16/+28
| | | | | | | | | is defined in the environment. Requested by: jmg & a few others Notes: svn path=/head/; revision=156330
* Add some more pthread stubs so that librt can use them.Daniel Eischen2006-03-051-4/+35
| | | | | | | | | | The thread jump table has been resorted, so you need to keep libc, libpthread, and libthr in sync. Submitted by: xu Notes: svn path=/head/; revision=156319
* Eliminate a race condition in timed waits (cv, mutex, and sleeps).Daniel Eischen2006-02-233-30/+30
| | | | | | | | | MFC Candidate. PR: 93592 Notes: svn path=/head/; revision=155962
* Don't forget to initialize a tailq before using it.Daniel Eischen2006-02-161-0/+1
| | | | | | | | MFC candidate Noticed by: luoqi Notes: svn path=/head/; revision=155745
* Increase the number of spinlocks, since libc's malloc implementation isJason Evans2006-01-131-1/+1
| | | | | | | | | about to significantly increase the number of spinlocks used. Approved by: markm (mentor) Notes: svn path=/head/; revision=154288
* In preparation for a new malloc implementation:Jason Evans2006-01-121-3/+3
| | | | | | | | | | | | | | | | * 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) Notes: svn path=/head/; revision=154248
* For the ``#ifdef NOTYET'' code that allows calling non-async-safeBrian Somers2006-01-031-1/+1
| | | | | | | | | | | | | functions in the child after a fork() from a threaded process, use __sys_setprocmask() rather than setprocmask() to keep our signal handling sane. Without this fix, signals are essentially ignored in said child and things such as protection violations result in an endless busy loop. Reviewed by: deischen Notes: svn path=/head/; revision=153989
* Include files thr_condattr_pshared.c and thr_mattr_pshare.c.David Xu2005-10-241-0/+2
| | | | Notes: svn path=/head/; revision=151616
* Add functions pthread_mutexattr_setpshared and pthread_mutexattr_getpshared.David Xu2005-10-241-0/+56
| | | | Notes: svn path=/head/; revision=151612
* Add function pthread_condattr_setpshared and pthread_condattr_getpshared.David Xu2005-10-241-0/+56
| | | | Notes: svn path=/head/; revision=151611
* Modify the code path of the ifdef NOTYET part of _kse_single_thread():Brian Somers2005-09-242-8/+11
| | | | | | | | | | | | | | | | | | | | | | | o Don't reinitialise the atfork() handler list in the child. We are meant to call the child handler, and on subsequent fork()s should call all three functions as normal. o Don't reinitialise the thread specific keyed data in the child after a fork. Applications may require this for context. o Reinitialise curthread->tlflags after removing ourselves from (and reinitialising) the various internal thread lists. o Reinitialise __malloc_lock in the child after fork() (to balance our explicitly taking the lock prior to the fork()). With these changes, it is possible to enable the NOTYET code in thr_kern.c to allow the use of non-async-safe functions after fork()ing from a threaded program. Reviewed by: Daniel Eischen <deischen@freebsd.org> [_malloc_lock reinitialisation has since been moved to avoid polluting the !NOTYET code] Notes: svn path=/head/; revision=150499
* Include needed headers that were obtained through <pthread.h>. Sort headersStefan Farfeleder2005-09-014-4/+12
| | | | | | | while here. Notes: svn path=/head/; revision=149691
* Allocate a thread's tcb last so it is easier to handle failures toDaniel Eischen2005-08-301-20/+21
| | | | | | | | | malloc() siginfo. PR: 85468 Notes: svn path=/head/; revision=149617
* Handle failure to malloc() part of the thread structure.Daniel Eischen2005-08-291-3/+4
| | | | | | | PR: 83457 Notes: svn path=/head/; revision=149579
* Don't attempt to initialize the rtld lock if it can't be malloc()'d.Daniel Eischen2005-08-291-5/+7
| | | | | | | PR: 83452 Notes: svn path=/head/; revision=149578
* - Prefix MUTEX_TYPE_MAX with PTHREAD_ to avoid namespace pollution.Stefan Farfeleder2005-08-192-3/+3
| | | | | | | | | - Remove the macros MUTEX_TYPE_FAST and MUTEX_TYPE_COUNTING_FAST. OK'ed by: deischen Notes: svn path=/head/; revision=149298
* Add a cancellation point for usleep().Daniel Eischen2005-08-031-1/+16
| | | | Notes: svn path=/head/; revision=148660
* 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