removeall() in list

castironpi at gmail.com castironpi at gmail.com
Sat Jan 12 09:04:19 EST 2008


On Jan 11, 5:26 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> castiro... at gmail.com writes:
>
> 1. Put a single thread in charge of the list, and communicate with it
> by message passing through Queues.  To get X out of the list, you'd
> send the mutator thread a message asking for removal.  The mutator
> thread would loop reading and processing messages from the queue,
> blocking when no requests are pending.  This is sort of the preferred
> Python style and is pretty simple to get correct, but if there are
> many such objects you can end up with more threads than you really
> want.

I've heard this called 'fire and forget'.  You can insure that
mutations are honored one-at-a-time  and in the order received.  How
do you make a -read- operation; wait for queued mutations, that is
lock for a turn on the queue?  Can you optionally read whatever the
state is, regardless of what's happened in the meantime?  Thing is,
one thread needs its -own- preceding operations completed before a
reading operation.



More information about the Python-list mailing list