summaryrefslogtreecommitdiffstats
path: root/lib/librthread/rthread.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* pthread_self() may be much cheaper and never more expensive than getthrid()guenther2011-12-281-2/+3
| | | | so prefer it for identifying the current thread
* On failure, pthread_kill() should return the errno, not -1guenther2011-12-271-2/+2
|
* Mark sigthr()'s sig argument as __unusedguenther2011-12-051-2/+2
|
* Implement cancelation for the basic syscall cancelation points,guenther2011-12-051-4/+40
| | | | | | using previously allocated SIGTHR to interrupt in-process syscalls and fixing the spelling of "cancelled" along the way. Modeled on FreeBSD's libthr
* Oh yeah, with TLS-lite we can get the thread handle without walking theguenther2011-11-091-23/+2
| | | | | | thread list reminded by dhill@
* Move <machine/spinlock.h> into rthread.h; strip out unnecessary #includesguenther2011-11-061-9/+2
|
* Use __tfork, __get_tcb, and __set_tcb to have a real TCB and per-threadguenther2011-10-171-29/+60
| | | | | errno. The ASM bits for _cerror are sketchy or missing for some archs but that can be corrected in-tree.
* Convert thrsleep() to an absolute timeout with clockid to eliminate aguenther2009-11-271-2/+2
| | | | | | race condition and prep for later support of pthread_condattr_setclock() "get it in" deraadt@, tedu@, cheers by others
* Change threxit() to take a pointer to a pid_t to zero out from theguenther2009-11-271-22/+38
| | | | | | | | | | kernel so that librthread can detect when a thread is completely done with its stack without need a kqueue. The dying thread moves itself to a GC list, other threads scan the GC list on pthread_create() and pthread_join() and free the stack and handle once the thread's thread id is zeroed. "get it in" deraadt@, tedu@, cheers by others
* Fix a race in the reaper discovered by Tobias Ulmer. kevents are identified by pid,tedu2009-02-201-2/+3
| | | | | | | | so in the event that two threads get the same pid in a row, as the second is dying it will update (not add) the kevent for the previous thread with its own stack, which it will then unmap soon after, which is bad. Doing the reaping first guarantees that there are no kevents with the same pid as the exiting thread when it registers itself. ok guenther kurt
* use calloc() instead of malloc() and memset()kevlo2008-10-131-5/+3
| | | | "look good" tedu@
* Match libpthread's behavior and make pthread_join(NULL, whatever) failguenther2008-08-141-2/+4
| | | | | | | instead of crashing ok kurt@ first observed by Jung <moorang at gmail.com>
* Fix 5771/library: in pthread_exit(), delay the call to _sem_post() thatguenther2008-08-141-4/+4
| | | | | | | | | unblocks the pthread_join() for this thread until the exiting thread is completely done with its thread structure, as the joining thread will free it once unblocked. Also, don't bother to call _sem_post() if the thread is detached. ok kurt@
* If the initial thread calls pthread_exit(), don't overwrite its threadguenther2008-08-141-3/+5
| | | | | structure, as the 'tid' member there is used by other parts of librthread to determine whether the current thread is the initial thread
* - Add fork/vfork wrapper functions to reset state in the child process.kurt2008-06-051-18/+23
| | | | | | | | | | | - Make an effort to protect important libc and ld.so critical areas during the fork(2)/vfork(2) sys call. - Add pthread_atfork(3) implementation based on Daniel Eischen's code. Original diff by Philip Guenther <guenther at gmail.com> with some additions and refinements by me. Positive test report from brad@ with many kde apps. fork(2) and pthread_atfork(3) pthread regresses pass. okay tedu@, kettenis@, marc@
* Register the locking hooks with ld.so.art2007-05-181-1/+45
| | | | drahn@ ok (long time ago)
* Initialize thread debug in _rthread_init. The debug verbositymarc2006-01-061-1/+3
| | | | | can be set in the environment using RTHREAD_DEBUG. ok, tedu@
* guess it's time to remove the init printf; sturm found a port thattedu2006-01-061-3/+1
| | | | didn't like it.
* In pthread_join(), check if we create a deadlock trying to joinotto2006-01-051-7/+9
| | | | with ourself and only free thread after a succesful join. ok marc@
* move malloc lock to libc interface filetedu2006-01-051-23/+1
|
* add -Wstrict-prototypes -Wmissing-prototypes -Wsign-comparemarc2006-01-051-4/+5
| | | | | | Minor tweaks to compile with the above, primarily in fixing the conflicts between semaphore.h and rthread.h "i like the additional warnings" tedu@
* Cleanup struct pthread and stack after thread exits. This version doesotto2006-01-041-20/+73
| | | | not use a separate reaper thread. ok tedu@ marc@
* allow threads to be created in a detached statemarc2006-01-041-5/+13
| | | | | do not allow a join to a detached thread "it looks good" otto@
* thread stack handling changes. Add guard zones and allow stackmarc2006-01-011-36/+7
| | | | | | | | size (and guard zone size) to be set using pthread_attr. Guard zones are specified in bytes, but implemented in terms of a page size. OK Otto@
* Implement suspend/resume and creation of initially suspended threads.otto2005-12-311-6/+16
| | | | | With this, java seems to be operational. Also make threads_ready non-static, which is needed for an upcoming diff. ok tedu@
* Remove exitinng thread from the list of threads. ok tedu@otto2005-12-301-1/+4
|
* use queue.h macros for thread house keeping; make some vars non-staticotto2005-12-301-20/+19
| | | | and fix a bug in thread creation error path. ok tedu@
* __aligned__ isn't really necessary on the struct, an aligned membertedu2005-12-301-2/+2
| | | | will make the right thing happen. verified by kettenis and drahn
* prototype all the thread syscalls in rthread.h for now.tedu2005-12-301-3/+1
| | | | update for new thrwakeup that takes a count argument
* Put the existing _np functions into separate file; introduceotto2005-12-291-26/+3
| | | | | pthread_stackseg_np(), from existing pthread lib. discussed with tedu@ ok marc@
* implement pthread_main_np(); ok tedu@otto2005-12-291-1/+13
|
* for reasons that do not make any sense whatsoever, _rthread_alloc_stacktedu2005-12-231-9/+9
| | | | must be called with the thread_lock held, or we crash in rfork_thread
* more consistently use _rthread prefix for all not meant to be exportedtedu2005-12-221-15/+15
| | | | interfaces that aren't static, and a few that are but which will change
* change init code to handle failure. (actually, make it impossible to fail,tedu2005-12-221-13/+14
| | | | | but still have the callers check for good measure). prompted by miod "err() in a library???"
* Bad commit, breaks hppa64. Prompted by deraadt@marco2005-12-221-3/+2
|
* Align hppa stack to 64 bytes.marco2005-12-211-2/+3
| | | | ok tedu
* make alloc_stack take an optional base, preparation for stack attributestedu2005-12-211-7/+16
| | | | deal with machines that have upside down stacks
* check a few remaining mallocs for failure, along with mmap and rforktedu2005-12-211-4/+41
| | | | started by miod
* fix rev 1.9brad2005-12-191-2/+2
| | | | pthread_concurrency -> pthread_setconcurrency
* update copyright to 2005tedu2005-12-191-2/+2
|
* add pthread_get/set_concurrency (useless for now)tedu2005-12-191-1/+18
| | | | add pthread_get/set_stack[addr] (info not used yet)
* initialize all spinlocks to _SPINLOCK_UNLOCKEDtedu2005-12-181-3/+5
|
* add pthread_cleanup_push and pthread_cleanup_poptedu2005-12-141-1/+39
|
* add pthread_kill (just kill(2) really)tedu2005-12-141-1/+7
|
* add bits for pthread_cancel. we don't really have cancellation points yettedu2005-12-141-1/+64
| | | | but some of the functions are here now.
* change keys to use table instead of list, makes a sane destructor implementationtedu2005-12-141-2/+5
| | | | possible
* correct implementation of pthread_cond_signal. it doesn't raise the semtedu2005-12-131-4/+2
| | | | value if there are no waiters.
* syscall is actually sched_yield now, as millert suggestedtedu2005-12-031-2/+1
|
* add userland thread library. incomplete, but functionaltedu2005-12-031-0/+265