Design Pattern for monitoring multiple objects -


i have multi threaded application, 1 thread owns multiple objects - updates them periodically. thread has access these objects , uses operation. pattern suit need?

you looking observer pattern

in nutshell, - main thread listen 'events' generated sensor threads. so, steps be:

a) sensor thread expose method, let main thread register event. use interface approach this.

b) data changes within sensor, call method on main thread (note has reference in step a). way, main thread come know time action.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -