[Subversion] / PEAK / src / peak / util / threads.py |
No default branch
Bookmark a link to HEAD:
(view)
(download)
(as text)
Normalized whitespace.
Added first draft 'RLock' and 'ResourceManager' classes that implement the PEAK locking interface (attempt/obtain/release/locked) in a re-entrant fashion for a single resource or an address space. The idea is that we will use a 'ResourceManager' to handle internal locks on addresses (such as filenames) that refer to external resources, by calling 'someRM.obtain("some URI")' to lock the resource, etc. The lockfiles in 'peak.running.lockfiles' should be changed to use this approach, so that even independent lockfile instances share the same actual threadlock. Also, we can use this when we begin implementing filesystem DM's (such as the one we need for writing XMI files). None of this code is tested; we really need a good unit test suite for the entire 'threads' module.
Fleshed-out the implementation of the 'waitflag' argument, emulating the exact values returned by Python in different states, and added a RuntimeError for an attempt to lock an already-locked DummyLock. Also, renamed LockType to DummyLock to more easily distinguish from the real thing when debugging, and made DummyLock a bit more lightweight using __slots__.
Allow waitmode to be passed to no-op lock acquire().
Make this work in the HAVE_THREADS==False case
Added thread-safety utility module, and modified UUID creation to use it.
cvs-admin@eby-sarna.com Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |