Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoiding recursion when reading/writing a port synchronously?

All port operations in Rebol 3 are asynchronous. The only way I can find to do synchronous communication is calling wait.

But the problem with calling wait in this case is that it will check events for all open ports (even if they are not in the port block passed to wait). Then they call their responding event handlers, but a read/write could be done in one of those event handlers. That could result in recursive calls to "wait".

How do I get around this?

like image 830
Shixin Zeng Avatar asked Nov 13 '13 14:11

Shixin Zeng


1 Answers

Why don´t you create a kind of "Buffer" function to receive all messages from assyncronous entries and process them as FIFO (first-in, first-out)?

This way you may keep the Assync characteristics of your ports and process them in sync mode.

like image 172
David BS Avatar answered Nov 11 '22 18:11

David BS