It seems that ev_stat does not ev_unref after starting its internal
timer, causing the event loop not to exit even if all ev_stats have
been stopped. The attached program does not exit when I run it and
"touch /tmp/foobar". I'm experiencing this on Linux 2.6.24.
// gcc -lm -I. .libs/libev.a ev_stat_bug.c -o ev_stat_bug
// ./ev_stat_bug &
// touch /tmp/foobar
//
// loop should exit, but doesn't
#include <stdio.h>
#include <assert.h>

#define EV_STANDALONE 1
#include <ev.c>

static ev_stat foobar;

static void
foobar_cb (EV_P_ ev_stat *w, int revents)
{
  assert(w == &foobar);
  assert(revents == EV_STAT);

  puts("/tmp/foobar modified\n");

  ev_stat_stop(EV_A_ w);
}

int main (void)
{
  ev_stat_init(&foobar, foobar_cb, "/tmp/foobar", 0.);
  ev_stat_start(EV_DEFAULT_ &foobar);
  ev_loop(EV_DEFAULT_ 0);
}
_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to