Commit Graph

20 Commits

Author SHA1 Message Date
Russ Cox
baef953da2 libthread: add pthreadperthread mode and use under ASAN
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-05-17 20:15:41 -04:00
rsc
46cfcf550f stupid gcc 2005-02-03 15:41:39 +00:00
rsc
3d867865ef better exit handling 2005-01-18 18:13:16 +00:00
rsc
7a2c88509b allow config to override kernel version 2005-01-17 21:30:05 +00:00
rsc
c345061e8d sunos fixes 2005-01-07 07:47:37 +00:00
rsc
a0a331aad9 add _procwakeupandunlock
to help ease locking contention
on Linux 2.4.
2005-01-06 23:43:42 +00:00
rsc
1d2533d010 restore old plan 9 property that when the
last thread exits the main proc, the remaining
program ends up in the background and the
program appears to have exited.
2004-12-28 22:36:24 +00:00
rsc
d54ead7fb9 more freebsd work 2004-12-28 04:20:39 +00:00
rsc
93eb807ac2 remove debugging 2004-12-28 03:42:11 +00:00
rsc
8cbd854a8a better exec handling 2004-12-27 19:11:33 +00:00
rsc
e127e40bb1 shuffle to allow use of execchan in non-pthreads impls 2004-12-27 17:19:44 +00:00
rsc
4dbefdd41c start linux pre-2.6 port 2004-12-27 16:52:26 +00:00
rsc
73722a8bbf confine pthreads to pthread.c 2004-12-27 03:49:03 +00:00
rsc
e1dc7e4511 signal handling, add prototype for pthreadinit 2004-12-27 00:13:48 +00:00
rsc
619085f0b4 more new libthread 2004-12-25 21:57:50 +00:00
rsc
1544f90960 New thread library 2004-12-25 21:56:33 +00:00
rsc
1956455367 more thread work 2004-11-08 16:03:20 +00:00
rsc
5093c3fa40 try to implement the daemonize hack. 2004-10-22 18:45:08 +00:00
rsc
ba15d71b0c debugging, more pthreads crap 2004-10-22 17:15:30 +00:00
rsc
e7821682ea add pthread 2004-09-23 19:03:46 +00:00