libthread: make pthreadperthread the default

This commit is contained in:
Russ Cox 2020-12-30 00:16:10 -05:00
parent b73633b1b4
commit e68f07d46f
2 changed files with 15 additions and 21 deletions

View file

@ -158,27 +158,21 @@ by
The thread library provides a The thread library provides a
.I main .I main
function that sets up a proc with a single thread executing function that sets up a proc with a single thread executing
.I threadmain .IR threadmain .
on a stack of size .PP
.I mainstacksize Every thread is backed by an operating system-provided
(default eight kilobytes).
To set
.IR mainstacksize ,
declare a global variable
initialized to the desired value
.RI ( e.g. ,
.B int
.B mainstacksize
.B =
.BR 1024 ).
When using the
.I pthread .I pthread
library, and runs on its system-provided stack;
.B mainstacksize .I mainstacksize
is ignored, as is the stack size argument to and the the stack size arguments to
.BR proccreate : .I proccreate
the first thread in each proc and
runs on the native system stack. .I threadcreate
are ignored.
Although each thread is backed by a separate
.IR pthread ,
the threads in a proc are still scheduled non-preemptively
as on Plan 9 and as described below.
.PP .PP
.I Threadcreate .I Threadcreate
creates a new thread in the calling proc, returning a unique integer creates a new thread in the calling proc, returning a unique integer

View file

@ -7,7 +7,7 @@ static uint threadnsysproc;
static Lock threadnproclock; static Lock threadnproclock;
static Ref threadidref; static Ref threadidref;
static Proc *threadmainproc; static Proc *threadmainproc;
static int pthreadperthread; static int pthreadperthread = 1;
static void addproc(Proc*); static void addproc(Proc*);
static void delproc(Proc*); static void delproc(Proc*);