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()
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_thread(f,())
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
See yield() statement.
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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.allocate_lock()
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 my goals
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 without
sleeping?
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ó:
But what about my main
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
11 matches
Mail list logo