fix locking
This commit is contained in:
@ -76,9 +76,11 @@ def _default_whendone(type, val, tb):
|
|||||||
|
|
||||||
class IOScanListThread(IOScanListBlock):
|
class IOScanListThread(IOScanListBlock):
|
||||||
_worker = None
|
_worker = None
|
||||||
|
_worker_lock = threading.Lock()
|
||||||
queuelength=100
|
queuelength=100
|
||||||
@classmethod
|
@classmethod
|
||||||
def getworker(cls):
|
def getworker(cls):
|
||||||
|
with cls._worker_lock:
|
||||||
if cls._worker:
|
if cls._worker:
|
||||||
return cls._worker
|
return cls._worker
|
||||||
import hooks
|
import hooks
|
||||||
@ -93,12 +95,10 @@ class IOScanListThread(IOScanListBlock):
|
|||||||
self._lock = threading.Lock()
|
self._lock = threading.Lock()
|
||||||
|
|
||||||
def add(self, rec):
|
def add(self, rec):
|
||||||
print self,'add',rec
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
return super(IOScanListThread,self).add(rec)
|
return super(IOScanListThread,self).add(rec)
|
||||||
|
|
||||||
def _remove(self, rec):
|
def _remove(self, rec):
|
||||||
print self,'remove',rec
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
return super(IOScanListThread,self)._remove(rec)
|
return super(IOScanListThread,self)._remove(rec)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user