New submission from Knut Eldhuset <knut.eldhu...@gmail.com>:

In essence I have the following loop running in thread A:

while True:
    with self.lock:
        time.sleep(0.1)

I then try to acquire the lock in thread B. This blocks forever on Linux, but 
runs fine on Windows XP.

The following modification makes the code behave as expected on Linux:

while True:
    time.sleep(0.001)
    with self.lock:
        time.sleep(0.1)

See the attached file for the full example. Python versions are:

Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)
[GCC 4.4.1] on linux2

and

Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on 
win32

----------
components: Library (Lib)
files: threadtest.py
messages: 100383
nosy: knutel
severity: normal
status: open
title: Sleeping after acquiring RLock causes acquire to block in other thread
versions: Python 2.6
Added file: http://bugs.python.org/file16430/threadtest.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8055>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to