ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> zope-List
zope-List
[Zope] import threading.Lock --> unpickleable
by Thomas Guettler other posts by this author
Apr 18 2002 1:13PM messages near this date
Re: [Zope] Question regarding connection of an IDE to Zope | Re: [Zope] import threading.Lock --> unpickleable
I was told that it is possible to syncronise
several zope-request with methods from the python
library.

But it is not that easy:

If you try to add a threading.Lock() instance to
a python class you get:

Error Type: UnpickleableError
Error Value: Cannot pickle objects

This means, you have to store it in an volatile
attribute. I tried it like this. But this
hangs if I delete the object which has
the Lock as_v_lock instance.


    def acquireLock(self):
         print "StollDMS.acquireLock"
         lock=getattr(self, "_v_lock", None)
         if not lock:
             self._v_lock=threading.Lock()
             lock=self._v_lock
         lock.acquire()

     def releaseLock(self):
         # acquire() should have been called
         # about one second before. This means the volatile lock
         # should still be there
         print "StollDMS.releaseLock"
         self._v_lock.release()

Any ideas?

  thomas



_______________________________________________
Zope maillist  -  Zope@[...].org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )
Thread:
Thomas Guettler
Thomas Guettler

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved