summaryrefslogtreecommitdiff
path: root/lib/libpthread
Commit message (Collapse)AuthorAgeFilesLines
* Back out last change and go back to using KSE locks instead of threadDaniel Eischen2003-11-161-16/+17
| | | | | | | | | locks until we know why this breaks ia64. Reported by: marcel Notes: svn path=/head/; revision=122801
* If a thread in critical region got a synchronous signal, according currentDavid Xu2003-11-091-0/+2
| | | | | | | | | signal handling mode, there is no chance to handle the signal, something must be wrong in the library, just call kse_thr_interrupt to dump its core. I have the code for a long time, but forgot to commit it. Notes: svn path=/head/; revision=122338
* Use THR lock instead of KSE lock to avoid scheduler be blocked in spinlock.David Xu2003-11-081-17/+16
| | | | | | | Reviewed by: deischen Notes: svn path=/head/; revision=122299
* style(9)Daniel Eischen2003-11-051-40/+53
| | | | | | | Reviewed by: bde Notes: svn path=/head/; revision=122131
* Don't declare the malloc lock; use the declaration provided in libc.Daniel Eischen2003-11-051-1/+6
| | | | | | | Noticed by: bde Notes: svn path=/head/; revision=122130
* Add pthread_atfork() source code. Dan forgot to commit this file.David Xu2003-11-051-0/+56
| | | | Notes: svn path=/head/; revision=122089
* Add an implementation for pthread_atfork().Daniel Eischen2003-11-046-6/+73
| | | | | | | | | | | Aside from the POSIX requirements for pthread_atfork(), when fork()ing, take the malloc lock to keep malloc state consistent in the child. Reviewed by: davidxu Notes: svn path=/head/; revision=122075
* Add the ability to reinitialize libpthread's internal FIFO-queueingDaniel Eischen2003-11-042-15/+57
| | | | | | | | | locks. Reviewed by: davidxu Notes: svn path=/head/; revision=122074
* Add the ability to reinitialize a spinlock (libc/libpthreadDaniel Eischen2003-11-041-12/+17
| | | | | | | | | internal lock, not a pthread spinlock). Reviewed by: davidxu Notes: svn path=/head/; revision=122073
* s/foo()/foo(void)/Daniel Eischen2003-11-041-2/+3
| | | | | | | Add a blank line after a variable declaration. Notes: svn path=/head/; revision=122072
* Libpthread uses the convention that all of its (non-weak) symbolsDaniel Eischen2003-11-041-5/+11
| | | | | | | | begin with underscores and provide weak definitions without underscores. Make the pthread spinlock conform to this convention. Notes: svn path=/head/; revision=122071
* Add the ability to reinitialize a mutex (internally, not a userlandDaniel Eischen2003-11-041-7/+20
| | | | | | | | | API). Reviewed by: davidxu Notes: svn path=/head/; revision=122070
* Use amd64_set_fsbase() instead of calling sysarch() directly.Peter Wemm2003-10-231-6/+1
| | | | Notes: svn path=/head/; revision=121409
* This test relies on the concurrency level being 1; make it so.Daniel Eischen2003-10-201-0/+3
| | | | Notes: svn path=/head/; revision=121266
* Update context code for my last ABI breakage of mcontext. I'm worriedPeter Wemm2003-10-171-7/+8
| | | | | | | | | | about the fpu code here. It should be using fxsave/fxrstor instead of saving/restoring the control word. The SSE registers are used a lot in gcc generated code on amd64. I'm not sure how this all fits together though. Notes: svn path=/head/; revision=121163
* Don't forget to initialize the fake tcb when the kcb is allocated.Daniel Eischen2003-10-121-0/+3
| | | | Notes: svn path=/head/; revision=121043
* Reverse the order of the first two arguments to _sparc64_enter_uts().Daniel Eischen2003-10-091-2/+2
| | | | | | | | The first argument is the UTS function, the second argument is the first argument to the UTS function. Who's on first. Notes: svn path=/head/; revision=120956
* Convert a couple of hardcoded values to constants. Make thr_getcontext()Daniel Eischen2003-10-092-3/+7
| | | | | | | | return 0 when called the first time, and return 1 when resumed by thr_setcontext(). Notes: svn path=/head/; revision=120939
* Add preliminary sparc64 support to libpthread. This does notDaniel Eischen2003-10-096-0/+509
| | | | | | | | | | | yet work, but hopefully someone familiar with the sparc64 port can pick up the reins. Submitted by: jake With mods by: deischen Notes: svn path=/head/; revision=120924
* Fix some comments for last commit.David Xu2003-10-081-5/+4
| | | | Notes: svn path=/head/; revision=120897
* Complete cancellation support for M:N threads, check cancelling flag whenDavid Xu2003-10-082-69/+157
| | | | | | | | | | thread state is changed from RUNNING to WAIT state and do some cancellation operations for every cancellable state. Reviewed by: deischen Notes: svn path=/head/; revision=120896
* Use thread lock instead of scheduler lock to eliminate lock contentionDavid Xu2003-10-081-18/+21
| | | | | | | | | for all wrapped syscalls under SMP. Reviewed by: deischen Notes: svn path=/head/; revision=120895
* Fix a logic error; use beq to check for a register being NULL, not bne.Daniel Eischen2003-10-021-1/+1
| | | | Notes: svn path=/head/; revision=120675
* Correct the library name.Ruslan Ermilov2003-10-021-1/+1
| | | | Notes: svn path=/head/; revision=120672
* - Remove error code that can't be returned (and original descriptionKen Smith2003-10-021-2/+0
| | | | | | | | | | | was not proper English) PR: docs/57434 Approved: blackend (mentor) Reviewed by: deischen Notes: svn path=/head/; revision=120670
* Only generate code for _LCK_ASSERT if _LCK_DEBUG is defined.David Xu2003-10-021-1/+6
| | | | Notes: svn path=/head/; revision=120658
* When concurrency level is reduced and a kse is exiting, make sure no otherDavid Xu2003-09-291-0/+13
| | | | | | | | | threads are still referencing the kse by migrating them to initial kse. Reviewed by: deischen Notes: svn path=/head/; revision=120567
* Remove unused variable.David Xu2003-09-281-2/+0
| | | | Notes: svn path=/head/; revision=120554
* Relink libc_r.a, libc_r.so and libc_r_p.so from libthr to libkse.Marcel Moolenaar2003-09-271-0/+12
| | | | | | | | | | | | | | On ia64, where there's no libc_r at all, libkse is now the default thread library by virtue of these links. The reasons for this change are: 1. libkse is slated to become the default thread library anyway, 2. active development and maintenance is only present for libkse, 3. GNOME and KDE, both in the process of being supported on ia64, work better with KSE; even on ia64. Notes: svn path=/head/; revision=120533
* Add __volatile keyword.David Xu2003-09-261-2/+4
| | | | Notes: svn path=/head/; revision=120469
* s/ia64/alpha/gMarcel Moolenaar2003-09-261-5/+4
| | | | Notes: svn path=/head/; revision=120454
* pthread API should return error code in return value not in errno.David Xu2003-09-251-2/+2
| | | | | | | Reviewed by: deischen Notes: svn path=/head/; revision=120436
* If syscall failed, restore old sigaction and return error to thread.David Xu2003-09-251-11/+19
| | | | Notes: svn path=/head/; revision=120429
* As comments in _mutex_lock_backout state, only current threadDavid Xu2003-09-241-6/+4
| | | | | | | | | | | | | | | | | can clear the pointer to mutex, not the thread doing mutex handoff. Because _mutex_lock_backout does not hold scheduler lock while testing THR_FLAGS_IN_SYNCQ and then reading mutex pointer, it is possible mutex owner begin to unlock and handoff the mutex to the current thread, and mutex pointer will be cleared to NULL before current thread reading it, so current thread will end up with deferencing a NULL pointer, Fix the race by making mutex waiters to clear their mutex pointers. While I am here, also save inherited priority in mutex for PTHREAD_PRIO_INERIT mutex in mutex_trylock_common just like what we did in mutex_lock_common. Notes: svn path=/head/; revision=120403
* Free thread name memory if there is.David Xu2003-09-231-0/+4
| | | | Notes: svn path=/head/; revision=120370
* Save and restore timeout field for signal frame just like what we didDavid Xu2003-09-222-1/+4
| | | | | | | | | for interrupted field. Also in _thr_sig_handler, retrieve current signal mask from kernel not from ucp, the later is pre-unioned mask, not current signal mask. Notes: svn path=/head/; revision=120338
* Fix FPU state restoring bug by jumping to right position.David Xu2003-09-221-2/+2
| | | | Notes: svn path=/head/; revision=120337
* Print waitset correctly.David Xu2003-09-221-1/+1
| | | | Notes: svn path=/head/; revision=120325
* Make KSE_STACKSIZE machine dependent by moving it from thr_kern.c toMarcel Moolenaar2003-09-195-3/+8
| | | | | | | | | pthread_md.h. This commit only moves the definition; it does not change it for any of the platforms. This more easily allows 64-bit architectures (in particular) to pick a slightly larger stack size. Notes: svn path=/head/; revision=120263
* _ia64_break_setcontext() now takes a mcontext_t. While here, defineMarcel Moolenaar2003-09-191-10/+3
| | | | | | | | | | | | | | | THR_SETCONTEXT as PANIC(). The THR_SETCONTEXT macro is currently not used, which means that the definition we had could be wrong, overly pessimistic or unknowingly right. I don't like the odds... The new _ia64_break_setcontext() and corresponding kernel fixes make KSE mostly usable. There's still a case where we don't properly restore a context and end up with a NaT consumption fault (typically an indication for not handling NaT collection points correctly), but at least now mutex_d works... Notes: svn path=/head/; revision=120254
* Stop using the setcontext() syscall to restore an async context.Marcel Moolenaar2003-09-191-5/+5
| | | | | | | | Instead use the break instruction with an immediate specially created for us. Notes: svn path=/head/; revision=120253
* pthread api should return error code in return value, not in errno.David Xu2003-09-181-2/+1
| | | | Notes: svn path=/head/; revision=120197
* Fix a typo. Also turn on PTHREAD_SCOPE_SYSTEM after fork().David Xu2003-09-161-1/+2
| | | | Notes: svn path=/head/; revision=120109
* Remove a comment that questioned why the size of the FPUDaniel Eischen2003-09-161-10/+1
| | | | | | | | | | | | | | state for amd64 was twice as large as necessary. Peter recently fixed this, so the comment no longer applies. Also, since the size of struct mcontext changed, adjust the threads library version of get&set context to match. FYI, any change layout/size change to any arch's struct mcontext will likely need some minor changes in libpthread. Notes: svn path=/head/; revision=120108
* Fix bogus comment and assign sigmask in critical region, useDavid Xu2003-09-151-2/+4
| | | | | | | SIG_CANTMASK to remove unmaskable signal masks. Notes: svn path=/head/; revision=120079
* Fix a bogus comment, sigmask must be maintained correctly,David Xu2003-09-151-1/+1
| | | | | | | it will be inherited in pthread_create. Notes: svn path=/head/; revision=120078
* 1. Allocating and freeing lock related resource in _thr_alloc and _thr_freeDavid Xu2003-09-144-94/+87
| | | | | | | | | | | | | | to avoid potential memory leak, also fix a bug in pthread_create, contention scope should be inherited when PTHREAD_INHERIT_SCHED is set, and also check right field for PTHREAD_INHERIT_SCHED, scheduling inherit flag is in sched_inherit. 2. Execute hooks registered by atexit() on thread stack but not on scheduler stack. 3. Simplify some code in _kse_single_thread by calling xxx_destroy functions. Reviewed by: deischen Notes: svn path=/head/; revision=120074
* When invoking an old style signal handler, use true traditional BSD style toDavid Xu2003-09-141-6/+13
| | | | | | | | | invoke signal handler. Reviewed by: deischen Notes: svn path=/head/; revision=120073
* Respect POSIX specification, a value return from pthread_attr_getguardsizeDavid Xu2003-09-142-16/+18
| | | | | | | | | | | | should be a value past to pthread_attr_setguardsize, not a rounded up value. Also fix a stack size matching bug in thr_stack.c, now stack matching code uses number of pages but not bytes length to match stack size, so for example, size 512 bytes and size 513 bytes should both match 1 page stack size. Reviewed by: deischen Notes: svn path=/head/; revision=120072
* Avoid garbage bits in c_flags by direct assigning value.David Xu2003-09-141-1/+1
| | | | | | | Reviewed by: deischen Notes: svn path=/head/; revision=120069