From: Bill Kelly Date: 2008-08-13T06:07:15+09:00 Subject: Re: Non-Threaded Timeout? From: "ara.t.howard" > > On Aug 12, 2008, at 12:38 PM, Bryan Richardson wrote: > >> However, it seems as though when creating the watchdog in the timeout >> method IO.popen sometimes blocks execution. I can't tell if it's due >> to the external (OLE) application blocking or something else. If I >> don't use the timeout method the OLE application blocks at a different >> time in the simulation, so I'm thinking it's not due to the OLE >> application blocking... > > can you prove that it's popen blocking? seems very strange... I'm just jumping into the middle of the thread, so apologies if I've missed something; but ... popen blocks ALL ruby threads on windows. This has been the bane of my existence for the past eight years. :) The problem is due to Microsoft's venerable design strategy: You are lost in a twisty little maze of API's, all incompatible. On Windows, the "file handle" returned by popen is not a "socket", and therefore is incompatible with "select". /me raises a cup of hemlock in toast to Redmond Note: Now that 1.9 ruby uses native threads, it should be possible to implement a nonblocking popen. However, last time I tested 1.9 for this behavior, it still blocked. (This was several months ago.) Regards, Bill