summaryrefslogtreecommitdiff
path: root/operators.c
diff options
context:
space:
mode:
Diffstat (limited to 'operators.c')
-rw-r--r--operators.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/operators.c b/operators.c
index 7e2520c..36dcd6a 100644
--- a/operators.c
+++ b/operators.c
@@ -157,12 +157,20 @@ opReceive(Datum *lefto, Array *left, Array *right)
{
if(lefto->tag != FunctionTag)
throwerror(nil, ESyntax);
- if(GetType(right) != AtypeInt)
+ if(GetType(right) != AtypeInt && GetType(right) != AtypeFloat)
throwerror(nil, EDomain);
- if(GetSize(right) != 1)
+ if(GetSize(right) != 1 && GetSize(right) != 0)
throwerror(nil, ELength);
USED(left);
- return messagerecv(lefto->func, right->intdata[0]);
+
+ int timeout = 0;
+ if(GetSize(right) == 0)
+ timeout = -1;
+ else if(GetType(right) == AtypeInt)
+ timeout = right->intdata[0]*1000;
+ else if(GetType(right) == AtypeFloat)
+ timeout = right->floatdata[0]*1000;
+ return messagerecv(lefto->func, timeout);
}
/* Dyadic operators */