Fix prepare watcher teardown in the event loop

This commit is contained in:
Thiago de Arruda 2014-03-27 19:22:44 -03:00
parent e995b21567
commit 3f7011ab91

View File

@ -65,10 +65,8 @@ bool event_poll(int32_t ms)
input_stop(); input_stop();
if (ms > 0) { if (ms > 0) {
/* Timer event did not trigger, stop the watcher since we no longer /* Stop the timer */
* care about it */
uv_timer_stop(&timer); uv_timer_stop(&timer);
uv_prepare_stop(&timer_prepare);
} }
return input_ready(); return input_ready();
@ -82,5 +80,6 @@ static void timer_cb(uv_timer_t *handle, int status)
static void timer_prepare_cb(uv_prepare_t *handle, int status) static void timer_prepare_cb(uv_prepare_t *handle, int status)
{ {
uv_timer_start(&timer, timer_cb, *(uint32_t *)handle->data, 0); uv_timer_start(&timer, timer_cb, *(uint32_t *)timer_prepare.data, 0);
uv_prepare_stop(&timer_prepare);
} }