Forum Navigation
portable selector for both pipes and sockets?
Posted: 10/22/07 18:38:30I know this is not your fault because Microsoft engineers decided to implement sockets differently than their other resource handles, but I am faced with this problem nonetheless. My problem is that I have a process running smoothly on linux that is single threaded and listens for new data on both a socket and multiple pipes from child processes. This works very well as the process only wakes up when there is data available on any of those sources.
Now, I need to port this code to Windows. I haven't actually tried it yet, but reading the docs from MS and from past experience, I believe the tango.io.selector.* will not work on Microsoft Pipes, including ones from child processes. The reason is because I think the only usable !ISelector is the SelectSelector, which uses select to wait for events. According to the documentation for select, it is only usable on sockets :(
So I think that although the code will compile, I think I will get an exception when I try adding the pipe to the selector. (going to start porting this today, so I'll see if it complains or not. Maybe there is an undocumented feature of select :)
Is there any thoughts on how to solve this problem other than resorting to multi-threading? I hate to have separate designs on windows and Linux, as I want to only maintain one code base. Simple differences that can be handled by version(Windows) are ok, but single vs. multi threaded is a drastic difference.
-Steve