On Thu, Feb 26, 2009 at 3:47 PM, Gabriel Genellina
<gagsl-...@yahoo.com.ar> wrote:
>> I'm looking for a function in the standard library or pywin32 package
>> that will block until a certain condition is met or it is interrupted
>> by Ctrl-C. For example, time.sleep() would have been perfect for my
>> needs if thread.interrupt_main() could interrupt the call from another
>> thread in the same way that Ctrl-C does. Unfortunately, that is not
>> the case.
>
> You may try MsgWaitForMultipleObjects - send a message to the main thread
> from the other thread.
> An alertable wait (like SleepEx) plus QueueUserAPC should work, I presume,
> but I've never actually tried in Python.

I tried using MsgWaitForMultipleObjects, but even with a wake mask of
0xffff Ctrl-C still did not interrupt the call. Maybe it has to do
with the way pywin32 implements it. QueueUserAPC is not available in
pywin32, but I suppose I can try getting to it via ctypes.

- Max
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to