comparison src/observer.c @ 126:55f2c6402c81

-
author Thinker K.F. Li <thinker@branda.to>
date Tue, 16 Sep 2008 15:44:01 +0800
parents 1c1f28c124c9
children d2cc7400c971
comparison
equal deleted inserted replaced
125:1c1f28c124c9 126:55f2c6402c81
1 #include <stdio.h> 1 #include <stdio.h>
2 #include "redraw_man.h" 2 #include "redraw_man.h"
3 #include "observer.h" 3 #include "observer.h"
4 #include "tools.h" 4 #include "tools.h"
5
6 #ifndef ASSERT
7 #define ASSERT(x)
8 #endif
5 9
6 subject_t *subject_new(ob_factory_t *factory, void *obj, int obj_type) { 10 subject_t *subject_new(ob_factory_t *factory, void *obj, int obj_type) {
7 subject_t *subject; 11 subject_t *subject;
8 12
9 subject = factory->subject_alloc(factory); 13 subject = factory->subject_alloc(factory);
22 * \todo Keep ob_factory following subject objects. 26 * \todo Keep ob_factory following subject objects.
23 */ 27 */
24 void subject_free(ob_factory_t *factory, subject_t *subject) { 28 void subject_free(ob_factory_t *factory, subject_t *subject) {
25 observer_t *observer; 29 observer_t *observer;
26 30
31 ASSERT(!(subject->flags & SUBF_FREE));
27 if(subject->flags & SUBF_BUSY) { 32 if(subject->flags & SUBF_BUSY) {
28 /* Postpond the request until busy status been stoped. 33 /* Postpond the request until busy status been stoped.
29 * SUBF_BUSY means in subject_notify(). 34 * SUBF_BUSY means in subject_notify().
30 */ 35 */
31 subject->flags |= SUBF_FREE; 36 subject->flags |= SUBF_FREE;