summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread
Commit message (Collapse)AuthorAgeFilesLines
* Free thread name memory if there is.davidxu2003-09-231-0/+4
|
* Save and restore timeout field for signal frame just like what we diddavidxu2003-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.
* Print waitset correctly.davidxu2003-09-221-1/+1
|
* Make KSE_STACKSIZE machine dependent by moving it from thr_kern.c tomarcel2003-09-191-2/+0
| | | | | | 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.
* pthread api should return error code in return value, not in errno.davidxu2003-09-181-2/+1
|
* Fix a typo. Also turn on PTHREAD_SCOPE_SYSTEM after fork().davidxu2003-09-161-1/+2
|
* Fix bogus comment and assign sigmask in critical region, usedavidxu2003-09-151-2/+4
| | | | SIG_CANTMASK to remove unmaskable signal masks.
* Fix a bogus comment, sigmask must be maintained correctly,davidxu2003-09-151-1/+1
| | | | it will be inherited in pthread_create.
* 1. Allocating and freeing lock related resource in _thr_alloc and _thr_freedavidxu2003-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
* When invoking an old style signal handler, use true traditional BSD style todavidxu2003-09-141-6/+13
| | | | | | invoke signal handler. Reviewed by: deischen
* Respect POSIX specification, a value return from pthread_attr_getguardsizedavidxu2003-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
* Avoid garbage bits in c_flags by direct assigning value.davidxu2003-09-141-1/+1
| | | | Reviewed by: deischen
* If user is seting scope process flag, clear PTHREAD_SCOPE_SYSTEM bitdavidxu2003-09-141-2/+4
| | | | | | accordingly. Reviewed by: deischen
* Check invalid parameter and return EINVAL.davidxu2003-09-141-0/+3
| | | | Reviewed by: deischen
* Original pthread_once code has memory leak if pthread_once_t is used indavidxu2003-09-092-9/+52
| | | | | | | | | | | | | | | a shared library or any other dyanmic allocated data block, once pthread_once_t is initialized, a mutex is allocated, if we unload the shared library or free those data block, then there is no way to deallocate the mutex, result is memory leak. To fix this problem, we don't use mutex field in pthread_once_t, instead, we use its state field and an internal mutex and conditional variable in libkse to do any synchronization, we introduce a third state IN_PROGRESS to wait if another thread is already in invoking init_routine(). Also while I am here, make pthread_once() conformed to pthread cancellation point specification. Reviewed by: deischen
* Add code to support pthread spin lock.davidxu2003-09-093-0/+161
| | | | Reviewed by: deischen
* Add small piece of code to support pthread_rwlock_timedrdlock anddavidxu2003-09-061-8/+43
| | | | pthread_rwlock_timedrwlock.
* Add code to support barrier synchronous object and implementdavidxu2003-09-046-6/+346
| | | | | | pthread_mutex_timedlock(). Reviewed by: deischen
* Remove repeated macro THR_IN_CONDQ.davidxu2003-09-041-1/+0
|
* Allow hooks registered by atexit() to run with current thread pointer set,davidxu2003-09-041-1/+4
| | | | without this change, my atexit test dumps core.
* Don't assume sizeof(long) = sizeof(int) on x86; use intdeischen2003-09-038-0/+17
| | | | | | | | | | | | instead of long types for low-level locks. Add prototypes for some internal libc functions that are wrapped by the library as cancellation points. Add memory barriers to alpha atomic swap functions (submitted by davidxu). Requested by: bde
* Move kse_wakeup_multi call to just before KSE_SCHED_UNLOCK.davidxu2003-09-031-4/+2
| | | | Tested on: SMP
* Allow the concurrency level to be reduced.deischen2003-08-303-35/+63
| | | | Reviewed by: davidxu
* Repost masked signal to kernel for scope system thread, it hardly happensdavidxu2003-08-211-6/+25
| | | | | | in real world. Reviewed by: deischen
* _thr_sig_check_pending is also called by scope system thread when it leavesdavidxu2003-08-201-0/+3
| | | | | | | | | critical region, we wrap some syscalls for thread cancellation point, and when syscalls returns, we call _thr_leave_cancellation_point, at the time if a signal comes in, it would be buffered, and when the thread leaves _thr_leave_cancellation_point, buffered signals will be processed, to avoid messing up normal syscall errno, we should save and restore errno around signal handling code.
* Add back a loop for up to PTHREAD_DESTRUCTOR_ITERATIONS todeischen2003-08-201-12/+20
| | | | | | | destroy thread-specific data. Display a warning when thread specific data remains after PTHREAD_DESTRUCTOR_ITERATIONS. Reviewed by: davidxu
* Support printing 64 bits pointer and long integer.davidxu2003-08-191-10/+27
| | | | Reviewed by: deischen
* Save and restore errno around sigprocmask.davidxu2003-08-191-1/+5
|
* Direct call exit if thread was never created. This makes it safe to calldavidxu2003-08-181-0/+2
| | | | | | pthread_exit in main() without creating any thread. Tessted by: deischen
* Treat initial thread as scope system thread when KSE mode is not activateddavidxu2003-08-1812-81/+47
| | | | | | | | | yet, so we can protect some locking code from being interrupted by signal handling. When KSE mode is turned on, reset the thread flag to scope process except we are running in 1:1 mode which we needn't turn it off. Also remove some unused member variables in structure kse. Tested by: deischen
* If threaded mode is not turned on yet, direct call __sys_sched_yield.davidxu2003-08-161-2/+3
|
* Keep initial kse and kse group just like we keep initial thread,davidxu2003-08-161-9/+11
| | | | | | Don't free them, so some code can still reference them. Reviewed by: deischen
* Access user provided pointer out of lock, and also check the case whendavidxu2003-08-161-8/+10
| | | | a key is less than 0.
* Always set tcb for bound thread, and switch tcb for M:N thread at correctdavidxu2003-08-131-7/+18
| | | | time.
* Correctly set current tcb. This fixes some IA64/KSE problems.davidxu2003-08-121-17/+11
| | | | Reviewed by: deischen, julian
* Add some quick pathes to exit process when signal action is default anddavidxu2003-08-101-0/+21
| | | | | | signal can causes process to exit. Reviewed by: deischen
* Initialize rtld lock just before turning on thread mode anddavidxu2003-08-103-35/+37
| | | | uninitialize rtld lock after thread mode shutdown.
* If thread mode is not activated yet, just call __sys_fork() directly,davidxu2003-08-101-1/+22
| | | | | | | | otherwise masks all signals until fork() returns, in child process, we reset library state before restoring signal masks until we reach a safe to point. Reviewed by: deischen
* Tweak rtld lock to allow recursive on reader lock and detect recursivedavidxu2003-08-101-10/+67
| | | | | | on writer lock. This is first cut at rwlock for rtld. Submitted by: desichen
* If thread mode is not activated yet, don't do extra work.davidxu2003-08-101-0/+4
| | | | Reviewed by: deischen
* o Add code to GC freed KSEs and KSE groupsdavidxu2003-08-081-25/+116
| | | | | | | o Fix a bug in kse_free_unlocked(), kcb_dtor shouldn't be called because the KSE is cached and will be resued in _kse_alloc(). Reviewed by: deischen
* Don't call kse_set_curthread() when scheduling a new bounddeischen2003-08-061-2/+3
| | | | | | | thread. It should only be called by the current kse and never by a KSE on behalf of another. Submitted by: davidxu
* Fix an off by one error in the number of arguments passed tomarcel2003-08-061-1/+1
| | | | | | makecontext(). We only supply 3, not 4. This is mostly harmless, except that on ia64 the garbage can include NaT bits, resulting in NaT consumption faults.
* Rethink the MD interfaces for libpthread to account fordeischen2003-08-057-210/+197
| | | | | | | | | archs that can (or are required to) have per-thread registers. Tested on i386, amd64; marcel is testing on ia64 and will have some follow-up commits. Reviewed by: davidxu
* sysctlbyname needs size_t type, not int.davidxu2003-07-311-1/+1
|
* Don't forget to unlock the scheduler lock. Somehow this got removeddeischen2003-07-301-0/+1
| | | | | | | from one of my last commits. This only affected priority ceiling mutexes. Pointy hat to: deischen
* Simplify sigwait code a bit by using a waitset and removing oldsigmask.davidxu2003-07-273-22/+17
| | | | Reviewed by: deischen
* Move idle kse wakeup to outside of regions where locks are held.deischen2003-07-238-73/+130
| | | | | | | | This eliminates ping-ponging of locks, where the idle KSE wakes up only to find the lock it needs is being held. This gives little or no gain to M:N mode but greatly speeds up 1:1 mode. Reviewed & Tested by: davidxu
* Override libc function raise(), in threading mode, raise() willdavidxu2003-07-192-0/+54
| | | | | | send signal to current thread. Reviewed by: deischen
* Cleanup thread accounting. Don't reset a threads timeslicedeischen2003-07-183-38/+27
| | | | | | | | when it blocks; it only gets reset when it yields. Properly set a thread's default stack guardsize. Reviewed by: davidxu
OpenPOWER on IntegriCloud