Queue.Queue-like class without the busy-wait
Antoon Pardon
apardon at forel.vub.ac.be
Wed Mar 30 03:52:15 EST 2005
Op 2005-03-30, Paul Rubin schreef <http>:
>> > 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.
I'm not sure that this would be an acceptable approach. I did the man
semop and it indicates this is part of system V IPC. This makes me
fear that semaphores will use file descriptors or other resources
that are only available in a limited amount. Not usefull if you are
talking about thousands of threads.
--
Antoon Pardon
More information about the Python-list
mailing list