Improved process callbacks
Closed this issue · 0 comments
arnobaer commented
An optimized approach for custom process/thread callback registration and calls.
class Process(comet.Process):
def run(self):
while self.running:
self.push("temp", 22.5)
self.push("humid", 50.0)
self.push("status", 42)
process = Process(
fail=ctrl.handle_error, # built in callback
temp=ctrl.handle_temp,
humid=ctrl.handle_humid
)
process.callbacks["status"] = ctrl.handle_status
...
Optional move built in callbacks begin
, finish
and fail
also to property callbacks
to avoid accidental assignment in process run()
.