3 ms·
Selective receive seemed unimportant, but I read the PDF presentation at the bottom to find out why he thought it was important. And I think he's right. Basica
by lincolnq 17y ago
Selective receive seemed unimportant, but I read the PDF presentation at the bottom to find out why he thought it was important. And I think he's right.
Basically it allows your process to simulate synchronous calls (by sending, then entering a state where you won't receive any other messages besides the one you're waiting for). And in certain cases, you _really_ want those synchronous calls (sometimes, it just doesn't make sense to handle any other events until the synchronous call returns).
He uses a hardware example to make it clear -- say you have to issue commands to hardware in a certain order, but with delays between them. In a non-blocking system, you have to write a complicated state machine to handle all the events and buffer the ones which are not "hardware is ready for next command". With selective receive, you can use selective receive between hardware calls: send to the hardware, receive only the "hardware ready", send again.