Philip Jenvey  committed 4a68222

make file_syncronized fallback to mutex_synchronizer for platforms that lack flock

  • Participants
  • Parent commits 6284fd3
  • Branches trunk

Comments (0)

Files changed (2)

File beaker/

     def release(self):
-synchronizers = util.WeakValuedRegistry()
-def synchronizer(identifier, cls, **kwargs):
-    return synchronizers.sync_get((identifier, cls), cls, identifier, **kwargs)
+_synchronizers = util.WeakValuedRegistry()
+def _synchronizer(identifier, cls, **kwargs):
+    return _synchronizers.sync_get((identifier, cls), cls, identifier, **kwargs)
 def file_synchronizer(identifier, **kwargs):
-    return synchronizer(identifier, FileSynchronizer, **kwargs)
+    if not has_flock:
+        return mutex_synchronizer(identifier)
+    else:
+        return _synchronizer(identifier, FileSynchronizer, **kwargs)
 def mutex_synchronizer(identifier, **kwargs):
-    return synchronizer(identifier, ConditionSynchronizer, **kwargs)
+    return _synchronizer(identifier, ConditionSynchronizer, **kwargs)
 class null_synchronizer(object):
     def acquire_write_lock(self, wait=True):

File tests/

 import time
 import unittest
 from beaker.container import *
-from beaker.synchronization import synchronizers
+from beaker.synchronization import _synchronizers
 from beaker.cache import clsmap
 import thread