summaryrefslogtreecommitdiff
path: root/sys/src/9/port/chan.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-10-25 01:54:09 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-10-25 01:54:09 +0200
commitb66c4a6232489ede3bfe29b813d5fee0a66dc11f (patch)
treeaed57726ef89ed8968eba975dd7eba618bee7bda /sys/src/9/port/chan.c
parent3142af56d8e76ed73d9bc3591f910104a8b2a8b2 (diff)
kernel: keep one closeproc arround in case we are unable to fork a new one
closechanq() is unable to fork a new closeproc when palloc is locked. so we spawn a closeproc early in chandevinit() and make sure theres always one process arround to handle the queue.
Diffstat (limited to 'sys/src/9/port/chan.c')
-rw-r--r--sys/src/9/port/chan.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/src/9/port/chan.c b/sys/src/9/port/chan.c
index 6adb7f072..266c6f935 100644
--- a/sys/src/9/port/chan.c
+++ b/sys/src/9/port/chan.c
@@ -194,6 +194,8 @@ chandevreset(void)
devtab[i]->reset();
}
+static void closeproc(void*);
+
void
chandevinit(void)
{
@@ -201,6 +203,7 @@ chandevinit(void)
for(i=0; devtab[i] != nil; i++)
devtab[i]->init();
+ kproc("closeproc", closeproc, nil);
}
void
@@ -506,6 +509,8 @@ closeproc(void*)
c = clunkq.head;
if(c == nil){
unlock(&clunkq.l);
+ if(canqlock(&clunkq.q))
+ continue;
pexit("no work", 1);
}
clunkq.head = c->next;