summaryrefslogtreecommitdiff
path: root/lib/libthr/thread/thr_spinlock.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix the wrapper function around signals so that a signal handlingMike Makonnen2003-12-091-0/+11
| | | | | | | | thread on one of the mutex or condition variable queues is removed from those queues before the real signal handler is called. Notes: svn path=/head/; revision=123350
* There's no need for _umtxtrylock to be a separate function.Mike Makonnen2003-07-061-10/+0
| | | | | | | Roll it into the pre-existing macro that's used to call it. Notes: svn path=/head/; revision=117276
* Locking primitives and operations in libthr should use struct umtx,Mike Makonnen2003-06-291-2/+2
| | | | | | | | | | | | | | not spinlock_t. Spinlock_t and the associated functions and macros may require blocking signals in order for async-safe libc functions to behave appropriately in libthr. This is undesriable for libthr internal locking. So, this is the first step in completely separating libthr from libc's locking primitives. Three new macros should be used for internal libthr locking from now on: THR_LOCK, THR_TRYLOCK, THR_UNLOCK. Notes: svn path=/head/; revision=117048
* The move to _retire() a thread in the GC instead of in the thread'sMike Makonnen2003-06-291-15/+3
| | | | | | | | | | exit function has invalidated the need for _spin[un]lock_pthread(). The _spin[un]lock() functions can now dereference curthread without the danger that the ldtentry containing the pointer to the thread has been cleared out from under them. Notes: svn path=/head/; revision=117012
* _pthread_cancel() breaks the normal lock order of first locking theMike Makonnen2003-05-251-0/+10
| | | | | | | | | | | | | | | | joined and then the joiner thread. There isn't an easy (sane?) way to make it use the correct order without introducing races involving the target thread and finding which (active or dead) list it is on. So, after locking the canceled thread it will try to lock the joined thread and if it fails release the first lock and try again from the top. Introduce a new function, _spintrylock, which is simply a wrapper arround umtx_trylock(), to help accomplish this. Approved by: re/blanket libthr Notes: svn path=/head/; revision=115307
* Add two functions: _spinlock_pthread() and _spinunlock_pthread()Mike Makonnen2003-05-231-2/+14
| | | | | | | | | | | | | that take the address of a struct pthread as their first argument. _spin[un]lock() just become wrappers arround these two functions. These new functions are for use in situations where curthread can't be used. One example is _thread_retire(), where we invalidate the array index curthread uses to get its pointer.. Approved by: re/blanket libthr Notes: svn path=/head/; revision=115271
* - Define curthread as _get_curthread() and remove all direct calls toJeff Roberson2003-04-021-6/+0
| | | | | | | | | | _get_curthread(). This is similar to the kernel's curthread. Doing this saves stack overhead and is more convenient to the programmer. - Pass the pointer to the newly created thread to _thread_init(). - Remove _get_curthread_slow(). Notes: svn path=/head/; revision=112965
* - Add libthr but don't hook it up to the regular build yet. This is anJeff Roberson2003-04-011-0/+88
adaptation of libc_r for the thr system call interface. This is beta quality code. Notes: svn path=/head/; revision=112918