summaryrefslogtreecommitdiff
path: root/sys/src/libthread/sched.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2021-10-13 17:08:26 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2021-10-13 17:08:26 +0000
commit5a807265a819206f8342ab3a23b940a0c75049fc (patch)
treea84effb4eb8852b1346259b98772c5c269f91e09 /sys/src/libthread/sched.c
parent3fe3e370e3bcad21b61aec6cbf5d11a9398e805b (diff)
libthread: fix debug prints, simplify
Do the debuglevel check before calling the print function for _threaddebug, by making it a macro. Do not waste cycles passing arguments. Generalize the _threaddebug function into _threadprint() and add a varargcheck pragma. This function can also be used from _threadassert(). Fix missing arguments in one case, fix trailing newlines in _threaddebug(). Make _threadgetproc()/_threadsetproc() a macro, just dereferencing Proc**_threadprocp. Simplify the mainjump, just call _threadsetproc() directly without that mainp dance. Remove the _schedinit() argument, it uses _threadgetproc() now. Get rid of Mainarg struct, just have a global variable for argc.
Diffstat (limited to 'sys/src/libthread/sched.c')
-rw-r--r--sys/src/libthread/sched.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/src/libthread/sched.c b/sys/src/libthread/sched.c
index 888d64cc2..6e7a6d57a 100644
--- a/sys/src/libthread/sched.c
+++ b/sys/src/libthread/sched.c
@@ -36,14 +36,13 @@ unlinkproc(Proc *p)
}
void
-_schedinit(void *arg)
+_schedinit(void)
{
Proc *p;
Thread *t, **l;
- p = arg;
+ p = _threadgetproc();
p->pid = getpid();
- _threadsetproc(p);
while(setjmp(p->sched))
;
_threaddebug(DBGSCHED, "top of schedinit, _threadexitsallstatus=%p", _threadexitsallstatus);
@@ -164,7 +163,7 @@ Resched:
_threaddebug(DBGSCHED, "running %d.%d", t->proc->pid, t->id);
p->thread = t;
if(t->moribund){
- _threaddebug(DBGSCHED, "%d.%d marked to die");
+ _threaddebug(DBGSCHED, "%d.%d marked to die", t->proc->pid, t->id);
goto Resched;
}
t->state = Running;