
Giovanni P. Deretta wrote:
If the system has data ready to be read for that device, which reference should it dispatch them to ?
Well the system does not dispatch readiness messages to handles, but you register an handle with a callback to receive notification. If you register multiple handles, all of them get the notification.
That doesn't make much sense to me. Assuming an underlaying 'select()', I register file descriptors, not handlers, with a callback. And even if that callback would itself call multiple functions, how much sense does it make to let them all read from the device ? They would all need to coordinate so they see all the data they need.
Anyway, even if you have multiple copies of an handle, you should'n use more than one at once expecially from multiple threads and expecially stream handles (actually using the same datagram socket or accept socket from multiple threads should be fine)
Exactly. My point was really that I think making streams non-copyable would prevent such design errors, or at least, would make them harder to do. :-) Regards, Stefan