comparison src/observer.c @ 206:748896358da2

Export subject_add_event_observer() to rest of the system. - declare it in mb_observer.h
author Thinker K.F. Li <thinker@branda.to>
date Wed, 10 Dec 2008 12:02:17 +0800
parents 75ec0124202a
children 29e1b2bffe4c
comparison
equal deleted inserted replaced
205:e91ba9e197bd 206:748896358da2
81 if(old_subject->flags & SUBF_STOP_PROPAGATE) 81 if(old_subject->flags & SUBF_STOP_PROPAGATE)
82 break; 82 break;
83 } 83 }
84 } 84 }
85 85
86 /*! \brief Add an observer for any type of events.
87 */
86 observer_t *subject_add_observer(subject_t *subject, 88 observer_t *subject_add_observer(subject_t *subject,
87 evt_handler hdr, void *arg) { 89 evt_handler hdr, void *arg) {
88 ob_factory_t *factory = subject->factory; 90 ob_factory_t *factory = subject->factory;
89 observer_t *observer; 91 observer_t *observer;
90 92
98 STAILQ_INS_TAIL(subject->observers, observer_t, next, observer); 100 STAILQ_INS_TAIL(subject->observers, observer_t, next, observer);
99 101
100 return observer; 102 return observer;
101 } 103 }
102 104
105 /*! \brief Add an observer for specified type of events.
106 */
103 observer_t *subject_add_event_observer(subject_t *subject, int type, 107 observer_t *subject_add_event_observer(subject_t *subject, int type,
104 evt_handler hdr, void *arg) { 108 evt_handler hdr, void *arg) {
105 ob_factory_t *factory = subject->factory; 109 ob_factory_t *factory = subject->factory;
106 observer_t *observer; 110 observer_t *observer;
107 111