taurus taurus

Previous topic

Singleton

Next topic

ThreadPool

This Page

ThreadDict

Inheritance diagram of ThreadDict

class ThreadDict(other=None, read_method=None, write_method=None, timewait=0.1, threaded=True)

Bases: dict

Thread safe dictionary with redefinable read/write methods and a background thread for hardware update. All methods are thread-safe using @self_lock decorator.

Note

any method decorated in this way CANNOT call other decorated methods! All values of the dictionary will be automatically updated in a separate Thread using read_method provided. Any value overwritten in the dict should launch the write_method.

Briefing:

a[2] equals to a[2]=read_method(2)
a[2]=1 equals to a[2]=write_method(2,1)
alive()
append(*args, **kwargs)
copy(*args, **kwargs)
get(*args, **kwargs)
get_last_cycle_start(*args, **kwargs)
get_last_update(*args, **kwargs)
get_timewait(*args, **kwargs)
has_key(*args, **kwargs)
items(*args, **kwargs)
iteritems(*args, **kwargs)
iterkeys(*args, **kwargs)
itervalues(*args, **kwargs)
keys(*args, **kwargs)
pop(*args, **kwargs)
run()
set_last_cycle_start(*args, **kwargs)
set_last_update(*args, **kwargs)
set_timewait(*args, **kwargs)
start()
stop()
threadkeys(*args, **kwargs)
tracer(text)
update(*args, **kwargs)
values(*args, **kwargs)