> When I run it, I notice that only one thread works and the other one
> never has a chance to run. I guess it is because the thread don't
> have a chance to release the GIL
This guess is wrong. A call to lock.acquire *does* release the GIL,
(as does the call to thread.sleep, as somebody else poi
On Oct 21, 7:49 am, MRAB <[EMAIL PROTECTED]> wrote:
> On Oct 21, 10:22 am, Carl Banks <[EMAIL PROTECTED]> wrote:
>
> > On Oct 21, 5:09 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
> > wrote:
>
> > > En Tue, 21 Oct 2008 04:58:00 -0200, Piotr Sobolewski
> > > <[EMAIL PROTECTED]> escribió:
>
> > > >
On Oct 21, 10:22 am, Carl Banks <[EMAIL PROTECTED]> wrote:
> On Oct 21, 5:09 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
> wrote:
>
> > En Tue, 21 Oct 2008 04:58:00 -0200, Piotr Sobolewski
> > <[EMAIL PROTECTED]> escribió:
>
> > > But what about my main question? Is it possible to release GIL wit
On Oct 21, 5:09 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Tue, 21 Oct 2008 04:58:00 -0200, Piotr Sobolewski
> <[EMAIL PROTECTED]> escribió:
>
> > But what about my main question? Is it possible to release GIL without
> > sleeping? I know that in this example situation I can achieve
On Oct 21, 1:12 am, Piotr Sobolewski <[EMAIL PROTECTED]> wrote:
> Hello,
> I have such program:
>
> import time
> import thread
> def f():
> global lock
> while True:
> lock.acquire()
> print thread.get_ident()
> time.sleep(1)
> lock.release()
> lock=thread.a
En Tue, 21 Oct 2008 04:58:00 -0200, Piotr Sobolewski
<[EMAIL PROTECTED]> escribió:
But what about my main question? Is it possible to release GIL without
sleeping? I know that in this example situation I can achieve my goals
without that - I can just move sleep outside of locked block. But I
j
Piotr Sobolewski schrieb:
Thanks for answers.
But what about my main question? Is it possible to release GIL without
sleeping? I know that in this example situation I can achieve my goals
without that - I can just move sleep outside of locked block. But I
just want to know it for future - can I j
See yield() statement.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for answers.
But what about my main question? Is it possible to release GIL without
sleeping? I know that in this example situation I can achieve my goals
without that - I can just move sleep outside of locked block. But I
just want to know it for future - can I just do something like
thread
Piotr Sobolewski wrote:
> Hello,
> I have such program:
>
> import time
> import thread
> def f():
> global lock
> while True:
> lock.acquire()
> print thread.get_ident()
> time.sleep(1)
> lock.release()
> lock=thread.allocate_lock()
> thread.start_new_thre
On Mon, Oct 20, 2008 at 10:12 PM, Piotr Sobolewski
<[EMAIL PROTECTED]> wrote:
> Hello,
> I have such program:
>
> import time
> import thread
> def f():
> global lock
> while True:
> lock.acquire()
> print thread.get_ident()
> time.sleep(1)
> lock.release()
>
11 matches
Mail list logo