diff options
Diffstat (limited to 'operators.c')
-rw-r--r-- | operators.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/operators.c b/operators.c index 36dcd6a..5359a54 100644 --- a/operators.c +++ b/operators.c @@ -155,13 +155,13 @@ opSelfReference1(Datum *lefto, Array *left, Array *right) Array * opReceive(Datum *lefto, Array *left, Array *right) { + USED(left); if(lefto->tag != FunctionTag) throwerror(nil, ESyntax); if(GetType(right) != AtypeInt && GetType(right) != AtypeFloat) throwerror(nil, EDomain); if(GetSize(right) != 1 && GetSize(right) != 0) throwerror(nil, ELength); - USED(left); int timeout = 0; if(GetSize(right) == 0) @@ -170,6 +170,9 @@ opReceive(Datum *lefto, Array *left, Array *right) timeout = right->intdata[0]*1000; else if(GetType(right) == AtypeFloat) timeout = right->floatdata[0]*1000; + if(GetSize(right) == 1 && timeout < 0) + throwerror(L"Timeout must be non-negative", EDomain); + return messagerecv(lefto->func, timeout); } |