diff options
author | Russ Cox <rsc@swtch.com> | 2008-05-06 12:51:19 -0400 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2008-05-06 12:51:19 -0400 |
commit | 0215811dc2517e7213a3cd7423f94710b20b57d1 (patch) | |
tree | 68d1431502f1014fed2060d3e01509792b122ce5 | |
parent | 454ae2ad280b9f41641ad2431604a04128d4db84 (diff) | |
download | plan9port-0215811dc2517e7213a3cd7423f94710b20b57d1.tar.gz plan9port-0215811dc2517e7213a3cd7423f94710b20b57d1.tar.bz2 plan9port-0215811dc2517e7213a3cd7423f94710b20b57d1.zip |
libthread: fix no-receive nbrecv etc. bug (David Jeannot)
-rw-r--r-- | src/libthread/channel.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/libthread/channel.c b/src/libthread/channel.c index 4fdf5e50..cd7750c0 100644 --- a/src/libthread/channel.c +++ b/src/libthread/channel.c @@ -363,8 +363,9 @@ chanrecvp(Channel *c) { void *v; - _chanop(c, CHANRCV, (void*)&v, 1); - return v; + if(_chanop(c, CHANRCV, (void*)&v, 1) > 0) + return v; + return nil; } int @@ -378,8 +379,9 @@ channbrecvp(Channel *c) { void *v; - _chanop(c, CHANRCV, (void*)&v, 0); - return v; + if(_chanop(c, CHANRCV, (void*)&v, 0) > 0) + return v; + return nil; } int @@ -393,8 +395,9 @@ chanrecvul(Channel *c) { ulong val; - _chanop(c, CHANRCV, &val, 1); - return val; + if(_chanop(c, CHANRCV, &val, 1) > 0) + return val; + return -1; } int @@ -408,7 +411,8 @@ channbrecvul(Channel *c) { ulong val; - _chanop(c, CHANRCV, &val, 0); - return val; + if(_chanop(c, CHANRCV, &val, 0) > 0) + return val; + return -1; } |