summaryrefslogtreecommitdiff
path: root/sys/src/9/port/devsd.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-05-20 23:55:38 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-05-20 23:55:38 +0200
commit18b8ae56e8f944df3c9078afd294aad03b204557 (patch)
tree35f559f15539189e9c1be8f74174b3da08806f30 /sys/src/9/port/devsd.c
parentf97798e710929c0acb2b110c1cc16b1b267039a0 (diff)
use resrcwait() when waiting for memory to become available
use resrcwait() when waiting for memory to become available. randomize the sleep time and properly restore old process status in case tsleep() gets interrupted.
Diffstat (limited to 'sys/src/9/port/devsd.c')
-rw-r--r--sys/src/9/port/devsd.c4
1 files changed, 2 insertions, 2 deletions
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();
}
}