omero.util.concurrency module

OMERO Concurrency Utilities

class util.concurrency.AtExitEvent(verbose=None, name='Unknown')[source]

Bases: Event

threading.Event extension which provides an additional method setAtExit() which sets “atexit” to true.

This class was introduced in 4.2.1 to work around issue #3260 in which logging from background threads produced error messages.

property atexit
property name
setAtExit()[source]
class util.concurrency.Timer(interval, function, args=None, kwargs=None)[source]

Bases: Timer

Based on threading._Thread but allows for resetting the Timer.

t = Timer(30.0, f, args=[], kwargs={}) t.start() t.cancel() # stop the timer’s action if it’s still waiting

# or

t.reset()

After excecution, the status of the run can be checked via the “completed” and the “exception” Event instances.

reset()[source]
run()[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

util.concurrency.get_event(name='Unknown')[source]

Returns a threading.Event instance which is registered to be “set” (Event.set()) on system exit.