Commit f129e7f180f8b4d735a87e7528671ebb30787006

Authored by Georg Hopp
1 parent 9c64e2ad

remove pending events buffer again as this was the wrong way

@@ -48,7 +48,6 @@ TR_CLASS(TR_EventDispatcher) { @@ -48,7 +48,6 @@ TR_CLASS(TR_EventDispatcher) {
48 TR_EXTENDS(TR_EventSubject); 48 TR_EXTENDS(TR_EventSubject);
49 49
50 TR_Queue events; 50 TR_Queue events;
51 - TR_Queue pending;  
52 TR_Hash handler; 51 TR_Hash handler;
53 TR_EventHandler default_handler; 52 TR_EventHandler default_handler;
54 int running; 53 int running;
@@ -76,8 +75,6 @@ void TR_eventDispatcherShutdown(TR_EventDispatcher); @@ -76,8 +75,6 @@ void TR_eventDispatcherShutdown(TR_EventDispatcher);
76 75
77 #define TR_eventDispatcherEnqueueEvent(disp,ev) \ 76 #define TR_eventDispatcherEnqueueEvent(disp,ev) \
78 (TR_queuePut((disp)->events, (ev))) 77 (TR_queuePut((disp)->events, (ev)))
79 -#define TR_eventDispatcherEnqueuePending(disp,ev) \  
80 - (TR_queuePut((disp)->pending, (ev)))  
81 #define TR_eventDispatcherStop(disp) \ 78 #define TR_eventDispatcherStop(disp) \
82 (((TR_EventDispatcher)disp)->running = 0) 79 (((TR_EventDispatcher)disp)->running = 0)
83 80
@@ -66,7 +66,6 @@ eventDispatcherCtor(void * _this, va_list * params) { @@ -66,7 +66,6 @@ eventDispatcherCtor(void * _this, va_list * params) {
66 TR_EventDispatcher this = _this; 66 TR_EventDispatcher this = _this;
67 67
68 this->events = TR_new(TR_Queue); 68 this->events = TR_new(TR_Queue);
69 - this->pending = TR_new(TR_Queue);  
70 this->handler = TR_new(TR_Hash); 69 this->handler = TR_new(TR_Hash);
71 this->mode = va_arg(*params, TR_EventDispatcherMode); 70 this->mode = va_arg(*params, TR_EventDispatcherMode);
72 this->default_handler = va_arg(*params, TR_EventHandler); 71 this->default_handler = va_arg(*params, TR_EventHandler);
@@ -98,7 +97,6 @@ eventDispatcherDtor(void * _this) { @@ -98,7 +97,6 @@ eventDispatcherDtor(void * _this) {
98 97
99 TR_hashCleanup(this->handler); 98 TR_hashCleanup(this->handler);
100 TR_delete(this->handler); 99 TR_delete(this->handler);
101 - TR_delete(this->pending);  
102 TR_delete(this->events); 100 TR_delete(this->events);
103 } 101 }
104 102
@@ -57,16 +57,8 @@ TR_eventDispatcherStart(TR_EventDispatcher this) @@ -57,16 +57,8 @@ TR_eventDispatcherStart(TR_EventDispatcher this)
57 int evtid = TR_EVD_CLIENT == this->mode 57 int evtid = TR_EVD_CLIENT == this->mode
58 ? TR_DISPATCHER_EVENT_USER_WAIT 58 ? TR_DISPATCHER_EVENT_USER_WAIT
59 : TR_DISPATCHER_EVENT_DATA_WAIT; 59 : TR_DISPATCHER_EVENT_DATA_WAIT;
60 - int * toutptr = NULL;  
61 60
62 - if (! TR_queueEmpty(this->pending)) {  
63 - toutptr = &ZERO;  
64 - TR_delete(this->events);  
65 - this->events = this->pending;  
66 - this->pending = TR_new(TR_Queue);  
67 - }  
68 -  
69 - event = TR_eventSubjectEmit((TR_EventSubject)this, evtid, toutptr); 61 + event = TR_eventSubjectEmit((TR_EventSubject)this, evtid, NULL);
70 } else { 62 } else {
71 event = TR_queueGet(this->events); 63 event = TR_queueGet(this->events);
72 } 64 }
@@ -98,7 +90,7 @@ TR_eventDispatcherStart(TR_EventDispatcher this) @@ -98,7 +90,7 @@ TR_eventDispatcherStart(TR_EventDispatcher this)
98 if (TR_EVENT_DONE == done) { 90 if (TR_EVENT_DONE == done) {
99 TR_delete(event); 91 TR_delete(event);
100 } else { 92 } else {
101 - TR_eventDispatcherEnqueuePending(this, event); 93 + TR_eventDispatcherEnqueueEvent(this, event);
102 } 94 }
103 } 95 }
104 } 96 }
Please register or login to post a comment