aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2020-12-30 00:16:10 -0500
committerRuss Cox <rsc@swtch.com>2020-12-30 00:20:26 -0500
commite68f07d46f5f168dc2076286627279540bf1f99e (patch)
treebc16faa386aa6f9e8189befa70b65728a3726ee7
parentb73633b1b4e9d3dbd680edf900b2b53befbf5a9a (diff)
downloadplan9port-e68f07d46f5f168dc2076286627279540bf1f99e.tar.gz
plan9port-e68f07d46f5f168dc2076286627279540bf1f99e.tar.bz2
plan9port-e68f07d46f5f168dc2076286627279540bf1f99e.zip
libthread: make pthreadperthread the default
-rw-r--r--man/man3/thread.334
-rw-r--r--src/libthread/thread.c2
2 files changed, 15 insertions, 21 deletions
diff --git a/man/man3/thread.3 b/man/man3/thread.3
index 02e4c868..c0a59091 100644
--- a/man/man3/thread.3
+++ b/man/man3/thread.3
@@ -158,27 +158,21 @@ by
The thread library provides a
.I main
function that sets up a proc with a single thread executing
-.I threadmain
-on a stack of size
-.I mainstacksize
-(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
+.IR threadmain .
+.PP
+Every thread is backed by an operating system-provided
.I pthread
-library,
-.B mainstacksize
-is ignored, as is the stack size argument to
-.BR proccreate :
-the first thread in each proc
-runs on the native system stack.
+and runs on its system-provided stack;
+.I mainstacksize
+and the the stack size arguments to
+.I proccreate
+and
+.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
.I Threadcreate
creates a new thread in the calling proc, returning a unique integer
diff --git a/src/libthread/thread.c b/src/libthread/thread.c
index 94173ebc..0c764000 100644
--- a/src/libthread/thread.c
+++ b/src/libthread/thread.c
@@ -7,7 +7,7 @@ static uint threadnsysproc;
static Lock threadnproclock;
static Ref threadidref;
static Proc *threadmainproc;
-static int pthreadperthread;
+static int pthreadperthread = 1;
static void addproc(Proc*);
static void delproc(Proc*);