Commit Briefs

Russ Cox

libthread: drop schedlock

Having two locks in the proc was causing deadlocks.


Russ Cox

libthread: simplify

Now that everything uses pthreads and pthreadperthread, can delete various conditionals, all the custom context code, and so on. Also update documents. Fixes #355.




Russ Cox

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.


Russ Cox

libthread: use consistent stack calculation code in makecontext

Also reduce duplication: makecontext is per-arch not per-os-arch. May fix #353.


Russ Cox

libthread: rm unused sparc-ucontext.h

More dead code.


Russ Cox

libthread: rm FreeBSD 4 code

Pretty sure FreeBSD 4 is gone now. :-)


Russ Cox

libthread: use mmap to allocate OpenBSD stacks

Should fix faults on OpenBSD. Fixes #218. Fixes #226.


Russ Cox

libthread: fix fault in teardown of proc

Fixes #332.


Russ Cox

libthread: run first thread in proc on system stack

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.


Dan Cross

Trivial changes: whitespace and modes.

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>


Russ Cox

libthread: add threadspawnd

R=rsc http://codereview.appspot.com/6742064


Russ Cox

openbsd updates (thanks Pascal Stumpf)

R=rsc http://codereview.appspot.com/6401049