aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/thread.c
Commit message (Collapse)AuthorAgeFilesLines
* SunOS: silence some warningsDan Cross2025-07-251-1/+1
| | | | | | Give `-Wformat=0` on illumos/Solaris so that the build does not complain about `execlp` not having a sentinel (it's nil). Also fix an integer size issue when casting to a void pointer.
* all: remove need for `-fcommon`Dan Cross2025-07-251-0/+1
| | | | | | | | | | Use `extern` where appropriate so that we can remove `-fcommon` on macOS and others. On macOS, `-fcommon` generates a number of linker warnings. I've tested building on macOS, Linux, FreeBSD, NetBSD, OpenBSD and illumos. I am not in a position to test on AIX or other more esoteric platforms, however.
* libthread: drop schedlockRuss Cox2020-12-301-1/+1
| | | | Having two locks in the proc was causing deadlocks.
* libthread: simplifyRuss Cox2020-12-301-207/+10
| | | | | | | | Now that everything uses pthreads and pthreadperthread, can delete various conditionals, all the custom context code, and so on. Also update documents. Fixes #355.
* libthread: make pthreadperthread the defaultRuss Cox2020-12-301-1/+1
|
* libthread: fix pthreadperthread bugsRuss Cox2020-12-301-107/+186
|
* libthread: add threadmaybackgroundRuss Cox2020-12-301-1/+1
| | | | | | | | Programs that want to background themselves now need to define threadmaybackground returning 1. This avoids a confusing (to people and debuggers) extra parent process for all the threaded programs that will never want to background themselves.
* libthread: fix use after free of first thread in each procRuss Cox2020-12-151-1/+9
| | | | | | This was causing sporadic but frequent crashes at startup in 9pserve on the new M1 Macs, correctly diagnosing a use-after-free.
* libthread: handle spurious _procsleep wakeups, fix $LIBTHREAD handlingRuss Cox2020-05-171-5/+23
|
* libthread: add pthreadperthread mode and use under ASANRuss Cox2020-05-171-6/+64
| | | | | | | | | | | | | | | | | | ASAN can't deal with the coroutine stacks. In theory we can call into ASAN runtime to let it know about them, but ASAN still has problems with fork or exit happening from a non-system stack. Bypass all possible problems by just having a full OS thread for each libthread thread. The threads are still cooperatively scheduled within a proc (in thos mode, a group of OS threads). Setting the environment variable LIBTHREAD=pthreadperthread will enable the pthreadperthread mode, as will building with CC9FLAGS='-fsanitize=address' in $PLAN9/config. This solution is much more general than ASAN - for example if you are trying to find all the thread stacks in a reproducible crash you can use pthreadperthread mode with any debugger that knows only about OS threads.
* libthread: comment stack border a bit moreRuss Cox2020-01-241-4/+10
|
* libthread: use mmap to allocate OpenBSD stacksRuss Cox2020-01-141-2/+7
| | | | | | | Should fix faults on OpenBSD. Fixes #218. Fixes #226.
* libthread: fix fault in teardown of procRuss Cox2020-01-131-0/+1
| | | | Fixes #332.
* libthread: run first thread in proc on system stackRuss Cox2020-01-121-14/+45
| | | | | | | For pthread systems that are fussy about which stack is used, this makes sure that threadmain runs on a system stack. If you only use proccreate (never threadcreate), all threads run on system stacks.
* Trivial changes: whitespace and modes.Dan Cross2020-01-101-13/+11
| | | | | | | | | Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross <cross@gajendra.net>
* libthread: Lion context routinesRuss Cox2011-10-131-1/+3
|
* build: OS X 64-bit buildRuss Cox2011-08-021-1/+6
| | | | | R=rsc http://codereview.appspot.com/4838047
* libthread: make page work on OS XRuss Cox2009-08-171-0/+4
|
* libthread: work around gcc warning on FreeBSDRuss Cox2008-12-231-1/+1
|
* libthread: correct sysfatal handler prototypeRuss Cox2008-10-261-4/+2
|
* libthread: add proper sysfatalTim Wiess2008-07-201-0/+16
|
* libthread: abort on single-threaded lock contentionRuss Cox2008-07-091-0/+24
|
* libthread: fix 64-bit bug in threadstart (Nathaniel Filardo)Russ Cox2008-06-011-1/+1
|
* libthread: remove bogus write in threadmainRuss Cox2008-02-281-1/+0
|
* pinrsc2006-06-261-0/+52
|
* fix proc leak; add p9usepwlibraryrsc2006-06-121-1/+8
|
* put threadinfo backrsc2006-04-211-1/+1
|
* darwin 386 startrsc2006-04-211-1/+2
|
* Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms.rsc2006-04-011-13/+13
|
* add threadidlersc2006-02-071-2/+29
|
* add threadidrsc2006-02-051-0/+9
|
* Print information on SIGQUIT, SIGINFO.rsc2005-09-261-0/+41
|
* Log if _threaddebuglevel is set.rsc2005-09-261-5/+2
|
* sunrsc2005-07-271-1/+1
|
* use full prototypesrsc2005-05-071-1/+1
|
* no need to setproc(0)rsc2005-03-181-1/+0
|
* add threaddatarsc2005-03-181-0/+6
|
* add check for procscheduler returningrsc2005-02-161-0/+1
|
* hard-to-find locking bugrsc2005-02-151-5/+19
|
* different fix for main proc bugrsc2005-02-141-11/+21
|
* work around stupid linux bugrsc2005-02-131-0/+8
|
* rename scheduler to have a more distinctive name, so stack traces can end therersc2005-01-231-5/+5
|
* Apparently SuSE 9.1's X distribution uses even biggerrsc2005-01-231-1/+1
| | | | | | | | | | buffers than the standard ones. 64kB appears to be enough for a stack in that case, but let's just go nuts and make the stacks enormous, so that it takes a few more doublings of X's stack needs before we run into this problem again. The VM system should take care of not actually using most of the memory anyway.
* proccreate racersc2005-01-181-1/+3
|
* add threadgetnamersc2005-01-181-0/+6
|
* 64-bit nonsensersc2005-01-181-3/+19
|
* useful warning commentrsc2005-01-161-0/+9
|
* oops sunosrsc2005-01-141-3/+3
|
* Many small edits.rsc2005-01-131-5/+15
|
* paranoiarsc2005-01-111-1/+8
|