RE: Locking problems with DorothyLocker

"Garth T Kidd" <garth-OnzZ1s1DREKDegMON/[email protected]> Wed, 22 Sep 2004 11:13:52 +1000
Newsgroups gmane.comp.pythin.pyds.devel
Organization Deadly Bloody Serious
Message-ID <[email protected]>
The second locking attempt is ``_RLock.acquire(self, blocking)``, which I'd
have hoped the preceding ``if blocking`` would have made sure is the
equivalent of your ``_RLock.acquire(self, blocking=1)``. Whilst I've
incorporated the change, I can't exactly see how it helps unless
``thread.allocate_lock()``'s lock objects are unusually pedantic about their
``waitflag`` argument. 

Well spotted on prevcontext; I'd only initialised it ``if myLocks``. 

-----Original Message-----
From: pyds-dev-admin-iYtK5bfT9M//Ad8WF/[email protected]
[mailto:pyds-dev-admin-iYtK5bfT9M//Ad8WF/[email protected]] On Behalf Of Thomas Klaeger
Sent: Sunday, 19 September 2004 6:07 AM
To: pyds-dev-iYtK5bfT9M//Ad8WF/[email protected]
Subject: [Pyds-dev] Locking problems with DorothyLocker

-- This time with patches attached....

I started using the pyds version from cvs and noticed locking problems if I
started pyds with the verbose option.

To track down the problems I changed Tool.py at two places:

* the tool threads are created with the tool name as thread name
* the lock object (DorothyRLock) are created with verbose=True

After these changes I noticed that DorothyRLock did not always lock
correctly - it seemed to not block if a lock was already acquired by another
thread. To correct this I changed the second locking attempt to
_RLock.acquire(self, blocking=1)

This change removed most of the locking problems, however sometimes I had an
error message about prevcontext not being initialized. So I also added some
code to always initialize prevcontext to None.

Garth, as you have written DorothyLocker, could you please review these
patches and submit them to Georg?

Regards,

Thomas