Interrput a thread

gervaz gervaz at gmail.com
Tue Jan 4 10:05:41 EST 2011


On 4 Gen, 07:13, Jean-Paul Calderone <calderone.jeanp... at gmail.com>
wrote:
> On Jan 3, 6:17 pm, Adam Skutt <ask... at gmail.com> wrote:
>
> > On Jan 3, 5:24 pm, Jean-Paul Calderone <calderone.jeanp... at gmail.com>
> > wrote:
>
> > > Of course.  The whole point here is not about threads vs processes.
> > > It's about shared memory concurrency vs non-shared memory
> > > concurrency.  You can implement both with threads and both with
> > > processes, but threads are geared towards shared memory and processes
> > > are geared towards non-shared memory.  So what most people mean by
> > > "use processes" is "don't use shared memory".
>
> > This is entirely my presumption, but I think if the OP were keenly
> > aware of the differences between thread and processes, it's pretty
> > likely he wouldn't have asked his question in the first place.
>
> Fair enough. :)
>
> > Also, I've written lots and lots of "use processes" code on multiple
> > platforms, and much of it has used some sort of shared memory
> > construct.  It's actually pretty common, especially in code bases with
> > a lot of history.  Not all the world is Apache.
>
> Hee hee, Apache. :)
>
>
>
> > Adam- Nascondi testo citato
>
> - Mostra testo citato -

BTW thanks for the suggestions. As in my original code snippet, the
shared object that the threads are using is the Queue, that itself
implement locking mechanism so I don't have to worry about concurrent
access. Regarding my question, it was just to have a hint on how a
thread termination can be handled as, per example, you have the
consumer-producer pattern.

Mattia



More information about the Python-list mailing list