[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Program halt after add event



Hi ,

Thanks!

Still the same problem even if I use tv.tv_sec=2;tv.tv_usec=0 .

Michael

On Tue, Sep 11, 2012 at 11:37 AM, Nick Mathewson <nickm@xxxxxxxxxxxxx> wrote:
On Tue, Sep 11, 2012 at 1:28 PM, Michael <michaelxmail@xxxxxxxxx> wrote:
> Hiï
>
> Thanks!
>
> Attached please find the test code(3 files):
>
> start.c Âwill create 2 threads: restart1 and Ârestart2, Âwhich will create 1
> timer each.
>
> time1.c Âfor restart1 and
>
> time2.c for restart2.
>
> while compile and execute the program, restart1 can't execute to line 101 to
> print the debug message, and restart2 also can't execute to line 101 to
> print the debug message .
>
> If you don't rewrite the timer in timeout_cb()(comment out line58-line63),
> it won't execute to line 101 until it executed the timeout_cb()
>

Here's your first problem:
    tv.tv_usec = 2000000;
This is likely choking your OS. Âtv_usec is microseconds, so it needs
to be less than one million.

If you wanted 200 msec, you need to say 200000; if you wanted 2
seconds, you need to say tv.tv_sec=2;tv.tv_usec=0;

yrs,
--
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users  Âin the body.