Problem using libev c++ timer

Savio Sebastian savio_joysebastian at
Fri Dec 23 13:09:14 CET 2011

Hi all,
I am trying to use the timer in libev using c++
Here is my code

class Timer {
    ev::timer stopTimer;
    Timer() {
    void timeout_cb(ev::timer &watcher, int revents) {
        cout << "TimeOut" << endl;

int main(int argc,char **argv) {
    ev::default_loop loop;
    Timer time;;
    return 0;

Here my problem is the timeout call back function is getting called immediatly after the program execution begins instead of getting called after the timer has expired
can anyone please help me

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the libev mailing list