11 Jun
2003
11 Jun
'03
9:31 p.m.
On Wednesday, 2003-06-11, 18:54, Filip wrote:
So how to write function that will wait until Handle is ready for reading ??
It would be very bad to use a while loop for this like while (!is_ready(handle)) /* do nothing */; which is called active waiting. Your processor is busy all the time doing checks. Normally the operating system supports passive waiting which means that your thread is suspended until the respective condition is true and woken up then. I don't know to what extend the different Haskell libraries support this kind of waiting for your problem.
And is there something like "if" ??
There is if <condition> then <value-for-fulfilled> else <value-for-not-fulfilled> and the when function for I/O actions. Wolfgang