tadd threadid - plan9port - [fork] Plan 9 from user space | |
git clone git://src.adamsgaard.dk/plan9port | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 9eda38e51f278aeceefd73bea6835eb929c00328 | |
parent 1b404fe6e4a50425853434086895517fbe2da4b3 | |
Author: rsc <devnull@localhost> | |
Date: Sun, 5 Feb 2006 17:50:09 +0000 | |
add threadid | |
Diffstat: | |
M include/thread.h | 1 + | |
M src/libthread/thread.c | 9 +++++++++ | |
2 files changed, 10 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/include/thread.h b/include/thread.h | |
t@@ -23,6 +23,7 @@ void _threadsetsysproc(void); | |
void _threadsleep(Rendez*); | |
_Thread *_threadwakeup(Rendez*); | |
#define yield threadyield | |
+int threadid(void); | |
/* | |
* I am tired of making this mistake. | |
diff --git a/src/libthread/thread.c b/src/libthread/thread.c | |
t@@ -370,6 +370,15 @@ threadsetstate(char *fmt, ...) | |
va_end(arg); | |
} | |
+int | |
+threadid(void) | |
+{ | |
+ _Thread *t; | |
+ | |
+ t = proc()->thread; | |
+ return t->id; | |
+} | |
+ | |
void | |
needstack(int n) | |
{ |