Commit f0ee9c80 authored by Martti Mela's avatar Martti Mela
Browse files

su_osx_runloop.c: optimized su_osx_port_step()

darcs-hash:20070209163525-1b897-5dad02f46e9b0e6a6840e9196ad34da8c046be14.gz
parent 129561a7
...@@ -284,10 +284,11 @@ su_port_t *su_osx_runloop_create(void) ...@@ -284,10 +284,11 @@ su_port_t *su_osx_runloop_create(void)
CFRunLoopObserverCreate(NULL, CFRunLoopObserverCreate(NULL,
kCFRunLoopAfterWaiting | kCFRunLoopBeforeWaiting, kCFRunLoopAfterWaiting | kCFRunLoopBeforeWaiting,
TRUE, 0, cf_observer_cb, self->sup_observer_cntx); TRUE, 0, cf_observer_cb, self->sup_observer_cntx);
#if 0
CFRunLoopAddObserver(CFRunLoopGetCurrent(), CFRunLoopAddObserver(CFRunLoopGetCurrent(),
self->sup_observer, self->sup_observer,
kCFRunLoopDefaultMode); kCFRunLoopDefaultMode);
#endif
} }
else else
return su_home_unref(su_port_home(self)), NULL; return su_home_unref(su_port_home(self)), NULL;
...@@ -1234,8 +1235,6 @@ su_duration_t su_osx_port_step(su_port_t *self, su_duration_t tout) ...@@ -1234,8 +1235,6 @@ su_duration_t su_osx_port_step(su_port_t *self, su_duration_t tout)
CFAbsoluteTime start; CFAbsoluteTime start;
int ret, timeout = tout > INT32_MAX ? INT32_MAX : tout; int ret, timeout = tout > INT32_MAX ? INT32_MAX : tout;
// XXX - mela assert(SU_OSX_PORT_OWN_THREAD(self));
rl = CFRunLoopGetCurrent(); rl = CFRunLoopGetCurrent();
if (!rl) if (!rl)
...@@ -1259,27 +1258,12 @@ su_duration_t su_osx_port_step(su_port_t *self, su_duration_t tout) ...@@ -1259,27 +1258,12 @@ su_duration_t su_osx_port_step(su_port_t *self, su_duration_t tout)
if (self->sup_base->sup_head) if (self->sup_base->sup_head)
tout = 0; tout = 0;
start = CFAbsoluteTimeGetCurrent(); ret = CFRunLoopRunInMode(kCFRunLoopDefaultMode,
for (;;) { tout/1000,
/* Run loop with only one pass, indicate if a source was processed */ TRUE);
ret = CFRunLoopRunInMode(kCFRunLoopDefaultMode,
0,
TRUE);
/* Ok, one of our sources was fired */ CFRunLoopWakeUp(rl);
if (self->sup_source_fired == 1) {
self->sup_source_fired = 0;
break;
}
#if 0
/* Check how long to run this loop */
if (CFAbsoluteTimeGetCurrent() >= start + timeout / 10000)
#else
break;
#endif
}
if (self->sup_base->sup_head) if (self->sup_base->sup_head)
su_base_port_getmsgs(self); su_base_port_getmsgs(self);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment