Don't ask to ask, just ask | |
PerlMonks |
Re^2: Can I/O operations on the same IO::Socket be executed in different threads?by sundialsvc4 (Abbot) |
on May 12, 2015 at 23:35 UTC ( [id://1126478]=note: print w/replies, xml ) | Need Help?? |
And yet, one thought that keeps banging against my head is this: “even if we can ‘make it to work,” does it ‘make sense?’” That, to me, is actually a key question here: “does it actually ‘make sense’ that one thread should ‘only read,’ and that another thread, ‘only write?’” I don’t think so. Why? Because somebody needs to be aware of: “the present-state of the remote client.” And, furthermore, this “present-state” can only be ascertained, subject to an unforeseen (and, unforeseeable ...) lag. Therefore, I suggest that the only truly-practicable design must be this: “put your letter in the box, raise the flag, and then wait for the postman.” “The Postman” has no race-conditions within himself. Therefore, he is able to efficiently serve the needs of any number of clients without conflict. To my way of thinking, both of the client-processes in question should be reading/writing from queues that are served by the Postman. They should not be attempting to read/write from the socket directly.
In Section
Seekers of Perl Wisdom
|
|