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 48 TR_EXTENDS(TR_EventSubject);
49 49
50 50 TR_Queue events;
51   - TR_Queue pending;
52 51 TR_Hash handler;
53 52 TR_EventHandler default_handler;
54 53 int running;
... ... @@ -76,8 +75,6 @@ void TR_eventDispatcherShutdown(TR_EventDispatcher);
76 75
77 76 #define TR_eventDispatcherEnqueueEvent(disp,ev) \
78 77 (TR_queuePut((disp)->events, (ev)))
79   -#define TR_eventDispatcherEnqueuePending(disp,ev) \
80   - (TR_queuePut((disp)->pending, (ev)))
81 78 #define TR_eventDispatcherStop(disp) \
82 79 (((TR_EventDispatcher)disp)->running = 0)
83 80
... ...
... ... @@ -66,7 +66,6 @@ eventDispatcherCtor(void * _this, va_list * params) {
66 66 TR_EventDispatcher this = _this;
67 67
68 68 this->events = TR_new(TR_Queue);
69   - this->pending = TR_new(TR_Queue);
70 69 this->handler = TR_new(TR_Hash);
71 70 this->mode = va_arg(*params, TR_EventDispatcherMode);
72 71 this->default_handler = va_arg(*params, TR_EventHandler);
... ... @@ -98,7 +97,6 @@ eventDispatcherDtor(void * _this) {
98 97
99 98 TR_hashCleanup(this->handler);
100 99 TR_delete(this->handler);
101   - TR_delete(this->pending);
102 100 TR_delete(this->events);
103 101 }
104 102
... ...
... ... @@ -57,16 +57,8 @@ TR_eventDispatcherStart(TR_EventDispatcher this)
57 57 int evtid = TR_EVD_CLIENT == this->mode
58 58 ? TR_DISPATCHER_EVENT_USER_WAIT
59 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 62 } else {
71 63 event = TR_queueGet(this->events);
72 64 }
... ... @@ -98,7 +90,7 @@ TR_eventDispatcherStart(TR_EventDispatcher this)
98 90 if (TR_EVENT_DONE == done) {
99 91 TR_delete(event);
100 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