Re: AW: Patch to DorothyLocker

Thomas Klaeger <[email protected]> Thu, 23 Sep 2004 16:14:52 +0200
Newsgroups gmane.comp.pythin.pyds.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------000909040804070005050501
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hello!

I believe I found the problem:

According to the python docs for thread.lock#acquire (as found at 
http://www.python.org/doc/2.2.3/lib/module-thread.html), acquire returns 
None if called without an argument, so at DorothyLocker line 222 the 
assert fails!

The attached patch corrects the problem by calling acquire(blocking=1)

Regards,
Thomas

Bauer, Georg schrieb:
> Hi!
> 
> 
>>Georg, could you please check in the patch Garth attached to his last
> 
> email?
> 
> Hmm. When trying the patch, I got the attached tracebacks (lots of them).
> Doesn't really look that good. I commited it nonetheless, so you can play
> with it. But it's definitely not there, yet.
> 
> Even more problematic: stopping it with pyds-stop and kill doesn't work any
> more - looks like there is some endless loop or something like that inside.
> I had to kill -9 the processes. Yuck. :-/
> 
> The problem with terminating doesn't occur when I start without -v, so it
> should be in the DorothyLocker stuff, not in the changes to Tool.py.
> 
> bye, Georg
> 

--------------000909040804070005050501
Content-Type: text/plain;
 name="200409221614-dorothy.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="200409221614-dorothy.diff"

Index: PyDS/DorothyLocker.py
===================================================================
RCS file: /pyds/PyDS/PyDS/DorothyLocker.py,v
retrieving revision 1.3
diff -u -r1.3 DorothyLocker.py
--- PyDS/DorothyLocker.py	23 Sep 2004 12:35:14 -0000	1.3
+++ PyDS/DorothyLocker.py	23 Sep 2004 14:07:20 -0000
@@ -216,7 +216,7 @@
 			# LockWhiner and then perform a blocking wait. 
 			whiner = LockWhiner(self, mycontext, myt)
 			whiner.start()
-			result = self.__block.acquire()
+			result = self.__block.acquire(blocking=1)
 		
 			# We can ONLY get here if we succeeded...
 			assert result # ... but you can never be too careful. 

--------------000909040804070005050501--