aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/thread.c
AgeCommit message (Collapse)AuthorFilesLines
2020-12-30libthread: simplifyRuss Cox1-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.
2020-12-30libthread: make pthreadperthread the defaultRuss Cox1-1/+1
2020-12-30libthread: fix pthreadperthread bugsRuss Cox1-107/+186
2020-12-30libthread: add threadmaybackgroundRuss Cox1-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.
2020-12-15libthread: fix use after free of first thread in each procRuss Cox1-1/+9
This was causing sporadic but frequent crashes at startup in 9pserve on the new M1 Macs, correctly diagnosing a use-after-free.
2020-05-17libthread: handle spurious _procsleep wakeups, fix $LIBTHREAD handlingRuss Cox1-5/+23
2020-05-17libthread: add pthreadperthread mode and use under ASANRuss Cox1-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.
2020-01-24libthread: comment stack border a bit moreRuss Cox1-4/+10
2020-01-14libthread: use mmap to allocate OpenBSD stacksRuss Cox1-2/+7
Should fix faults on OpenBSD. Fixes #218. Fixes #226.
2020-01-13libthread: fix fault in teardown of procRuss Cox1-0/+1
Fixes #332.
2020-01-12libthread: run first thread in proc on system stackRuss Cox1-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.
2020-01-10Trivial changes: whitespace and modes.Dan Cross1-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>
2011-10-13libthread: Lion context routinesRuss Cox1-1/+3
2011-08-02build: OS X 64-bit buildRuss Cox1-1/+6
R=rsc http://codereview.appspot.com/4838047
2009-08-17libthread: make page work on OS XRuss Cox1-0/+4
2008-12-23libthread: work around gcc warning on FreeBSDRuss Cox1-1/+1
2008-10-26libthread: correct sysfatal handler prototypeRuss Cox1-4/+2
2008-07-20libthread: add proper sysfatalTim Wiess1-0/+16
2008-07-09libthread: abort on single-threaded lock contentionRuss Cox1-0/+24
2008-06-01libthread: fix 64-bit bug in threadstart (Nathaniel Filardo)Russ Cox1-1/+1
2008-02-28libthread: remove bogus write in threadmainRuss Cox1-1/+0
2006-06-26pinrsc1-0/+52
2006-06-12fix proc leak; add p9usepwlibraryrsc1-1/+8
2006-04-21put threadinfo backrsc1-1/+1
2006-04-21darwin 386 startrsc1-1/+2
2006-04-01Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms.rsc1-13/+13
2006-02-07add threadidlersc1-2/+29
2006-02-05add threadidrsc1-0/+9
2005-09-26Print information on SIGQUIT, SIGINFO.rsc1-0/+41
2005-09-26Log if _threaddebuglevel is set.rsc1-5/+2
2005-07-27sunrsc1-1/+1
2005-05-07use full prototypesrsc1-1/+1
2005-03-18no need to setproc(0)rsc1-1/+0
2005-03-18add threaddatarsc1-0/+6
2005-02-16add check for procscheduler returningrsc1-0/+1
2005-02-15hard-to-find locking bugrsc1-5/+19
2005-02-14different fix for main proc bugrsc1-11/+21
2005-02-13work around stupid linux bugrsc1-0/+8
2005-01-23rename scheduler to have a more distinctive name, so stack traces can end therersc1-5/+5
2005-01-23Apparently SuSE 9.1's X distribution uses even biggerrsc1-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.
2005-01-18proccreate racersc1-1/+3
2005-01-18add threadgetnamersc1-0/+6
2005-01-1864-bit nonsensersc1-3/+19
2005-01-16useful warning commentrsc1-0/+9
2005-01-14oops sunosrsc1-3/+3
2005-01-13Many small edits.rsc1-5/+15
2005-01-11paranoiarsc1-1/+8
2005-01-11os x changesrsc1-2/+13
2005-01-07allow lock passingrsc1-1/+2
2005-01-06add _procwakeupandunlockrsc1-2/+4
to help ease locking contention on Linux 2.4.