I\'m having trouble using SyncManager.Lock
correctly. I read the official doc, but it offers no working example. I also have no idea how to use SyncManage
I figured out a workaround. Don't use the builtin SyncManager.Lock()
for the following reasons:
Solution is to register your own lock manager:
from multiprocessing.managers import BaseManager, AcquirerProxy
global_lock = mp.Lock()
def get_lock():
print('getting global_lock')
return global_lock
Server.register('Lock', get_lock, AcquirerProxy)