I'm trying to create a shared dictionary in python which should hold created events.
# prepare shared dictionary which will hold our events
mgr = multiprocessing.Manager()
event_storage = mgr.dict()
# start webserver
w = WebServer(server['host'], server['port'])
p = Process(target=w.start, args=(event_storage,))
p.start()
for i, param in enumerate(_DEFS):
for tc in testcases():
# create and store event for current testcase
request_id = get_new_rid()
event_storage[request_id] = Event() # problematic line
# other code...
After executing this code i get an exception: RuntimeError: Condition objects should only be shared between processes through inheritance
Can anyone help me please to solve this problem or give me a hint how to share multiple events between processes?
Edit: My question is especially about the combination shared dictionary and events. The "possible duplicate" doesn't handle the question about sharing Events()
. Changing
event_storage[request_id] = Event() # problematic line
to
event_storage[request_id] = "test # problematic line
works - but doesn't solve the problem.