Skip to content

Commit

Permalink
Move heartbeat and socket cleanup out of individual run functions int…
Browse files Browse the repository at this point in the history
…o _RunOnce()
  • Loading branch information
jakedouglas committed Nov 22, 2009
1 parent 8a807c9 commit 0319eb8
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions ext/em.cpp
Expand Up @@ -490,12 +490,16 @@ EventMachine_t::_RunOnce

bool EventMachine_t::_RunOnce()
{
bool ret;
if (bEpoll)
return _RunEpollOnce();
ret = _RunEpollOnce();
else if (bKqueue)
return _RunKqueueOnce();
ret = _RunKqueueOnce();
else
return _RunSelectOnce();
ret = _RunSelectOnce();
_DispatchHeartbeats();
_CleanupSockets();
return ret;
}


Expand Down Expand Up @@ -544,9 +548,6 @@ bool EventMachine_t::_RunEpollOnce()
EmSelect (0, NULL, NULL, NULL, &tv);
}

_DispatchHeartbeats();
_CleanupSockets();

#ifdef BUILD_FOR_RUBY
if (!rb_thread_alone()) {
rb_thread_schedule();
Expand Down Expand Up @@ -613,9 +614,6 @@ bool EventMachine_t::_RunKqueueOnce()
++ke;
}

_DispatchHeartbeats();
_CleanupSockets();

// TODO, replace this with rb_thread_blocking_region for 1.9 builds.
#ifdef BUILD_FOR_RUBY
if (!rb_thread_alone()) {
Expand Down Expand Up @@ -874,9 +872,6 @@ bool EventMachine_t::_RunSelectOnce()
}
}

_DispatchHeartbeats();
_CleanupSockets();

return true;
}

Expand Down

0 comments on commit 0319eb8

Please sign in to comment.