From df970459f9b37386fbfd4b7f3646825c8029caa8 Mon Sep 17 00:00:00 2001 From: rsc Date: Mon, 26 Jun 2006 05:47:59 +0000 Subject: pin --- man/man3/thread.3 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'man/man3') diff --git a/man/man3/thread.3 b/man/man3/thread.3 index 92abb3f3..5145a543 100644 --- a/man/man3/thread.3 +++ b/man/man3/thread.3 @@ -37,6 +37,8 @@ threadmain, threadnotify, threadid, threadpid, +threadpin, +threadunpin, threadsetgrp, threadsetname, threadsetstate, @@ -84,6 +86,8 @@ int threadcreate(void (*fn)(void*), void *arg, uint stacksize) void threadexits(char *status) void threadexitsall(char *status) void yield(void) +int threadpin(void) +int threadunpin(void) .XX int threadid(void) int threadgrp(void) @@ -260,6 +264,20 @@ System calls such as block the entire proc; all threads in a proc block until the system call finishes. .PP +.I Threadpin +disables scheduling inside a proc, `pinning' the current +thread as the only runnable one in the current proc. +.I Threadunpin +reenables scheduling, allowing other procs to run once the current +thread relinquishes the processor. +.I Threadpin +and +.I threadunpin +can lead to deadlock. +Used carefully, they can make library routines that use +.B qlocks +appear atomic relative to the current proc, like a system call. +.PP As mentioned above, each thread has a unique integer thread id. Thread ids are not reused; they are unique across the life of the program. .I Threadid -- cgit v1.2.3