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
Post a Comment