Antoon Pardon <[EMAIL PROTECTED]> writes:
> > There needs to be a way to send signals to threads, or raise
> > asynchronous exceptions in them.  There's been some discussion in
> > sourceforge about that, but the issues involved are complex.
> 
> Well I have raised this issue before and as far as I understand, the
> big problem seems to be the various kind of behaviour you can get
> depending on what platform you are working, so writing a module so
> that python programs behave the same on various platforms seems a
> hell of a job.

I think there are some issues that are even more fundamentally
confusing.  It's hard to figure out exactly what behavior is
desirable, let alone how to implement it.

> So I decided not to pester the python people for this kind of
> functionality, although I would very much like to have it.

Yes, I hope something happens sometime, but I don't have any immediate
concrete suggestions.  I'm not enough of a concurrency whiz to know how
other languages handle it.

> I have been playing with the C-API and have somekind of class that
> allows one thread to raise an excetion in an other but that wouldn't
> be a solution here, since the raised exception will not manifest
> itself while the thread is in a C-function.

Yes, that sounds hairy if done in a general way.

> > I think the best bet for the short term is handling it at the C level,
> > with sigalarm.  Another way is to have chained sigalarm handlers in
> > the main thread.
> 
> Possible, but I don't have the time to investigate that possibility now.

Actually there's a simple and obvious approach: Linux and Windows both
already implement semaphore objects with timeouts (see "man semop"
under Linux).  Other modern Unixes probably also have them.  So I'd
think it would be straightforward to just make a C module that wraps
these semaphores with the C API.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to