tags:

views:

96

answers:

1

Unclear if there are ccr gurus here but let's try anyway.

I have this function in my code:

dq.EnqueueTimer(TimeSpan.FromMilliseconds(TIMEOUT), timeOutFn);

which will call my function after the timeout. However since I need this timer on a lot of open sockets, I would like to pass a parameter(or ID) to the timer function.

How do you do this?

Thanks

R

A: 

Something like this should do it.

var timerPort = new Port<DateTime>();
dq.EnqueueTimer(TimeSpan.FromMilliseconds(TIMEOUT), timerPort);
timerPort.Receive(ignored => MyFunc(myParam));
Nick Gunn
very, very clever!
Toad
Oops. the last line should be Arbiter.Activate(timerPort.Receive...)));
Nick Gunn