Commit Diff


commit - 1b404fe6e4a50425853434086895517fbe2da4b3
commit + 9eda38e51f278aeceefd73bea6835eb929c00328
blob - 75592ee9b216b2cd9b4a791199f3386fdfdb3023
blob + 9424d37e8d0f7f777c61d0dfeb63d8ac7a701252
--- include/thread.h
+++ include/thread.h
@@ -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.
blob - 145a503308788e0f1c415788e5f36b1e75806c3a
blob + ca4d35af66a0a348ff5d94e8ed1600ebb920e7bb
--- src/libthread/thread.c
+++ src/libthread/thread.c
@@ -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)
 {