summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/9/port/alloc.c2
-rw-r--r--sys/src/9/port/devsd.c4
-rw-r--r--sys/src/9/port/pgrp.c12
3 files changed, 12 insertions, 6 deletions
diff --git a/sys/src/9/port/alloc.c b/sys/src/9/port/alloc.c
index 194eb9f37..6e422c9e3 100644
--- a/sys/src/9/port/alloc.c
+++ b/sys/src/9/port/alloc.c
@@ -175,7 +175,7 @@ smalloc(ulong size)
if(v != nil)
break;
if(!waserror()){
- tsleep(&up->sleep, return0, 0, 100);
+ resrcwait(0);
poperror();
}
}
diff --git a/sys/src/9/port/devsd.c b/sys/src/9/port/devsd.c
index 38b9a4548..5cc44b31c 100644
--- a/sys/src/9/port/devsd.c
+++ b/sys/src/9/port/devsd.c
@@ -849,7 +849,7 @@ sdbio(Chan* c, int write, char* a, long len, uvlong off)
}else{
while((b = sdmalloc(nb*unit->secsize)) == nil){
if(!waserror()){
- tsleep(&up->sleep, return0, 0, 100);
+ resrcwait("no memory for sdbio");
poperror();
}
}
@@ -934,7 +934,7 @@ sdrio(SDreq* r, void* a, long n)
data = nil;
while(n > 0 && (data = sdmalloc(n)) == nil){
if(!waserror()){
- tsleep(&up->sleep, return0, 0, 100);
+ resrcwait("no memory for sdrio");
poperror();
}
}
diff --git a/sys/src/9/port/pgrp.c b/sys/src/9/port/pgrp.c
index 22fc78b56..21ac7af86 100644
--- a/sys/src/9/port/pgrp.c
+++ b/sys/src/9/port/pgrp.c
@@ -306,6 +306,10 @@ resrcwait(char *reason)
p = up->psstate;
if(reason) {
+ if(waserror()){
+ up->psstate = p;
+ nexterror();
+ }
up->psstate = reason;
now = seconds();
/* don't tie up the console with complaints */
@@ -314,7 +318,9 @@ resrcwait(char *reason)
print("%s\n", reason);
}
}
-
- tsleep(&up->sleep, return0, 0, 300);
- up->psstate = p;
+ tsleep(&up->sleep, return0, 0, 100+nrand(200));
+ if(reason) {
+ up->psstate = p;
+ poperror();
+ }
}