On Wed, Jul 02, 2008 at 01:46:36PM +0300, vvvua <[EMAIL PROTECTED]> wrote:
> Default loop  also maintain an  async io on sockets. The program  
> architecture  is designed with only one point of realisation of async  
> calls - in ev_loop (loop,0) with default loop;

It is totally unclear to me what you mean with "async io" - i assume this
is something in your program?

> First, i create a timer at 45sec.
> After each callback, i am trying to set timer on 5 seconds, but timer  
> waits 45 seconds.

You should probbaly show the code for that.

>    TimeSockMapper()
>    {
>        memset(&tm,0,sizeof(ev_timer));
>        memset(&repeat,0,sizeof(ev_tstamp));

You do not need to zero-initialise the watcher structures, this will only
bloat your code.

> void timeout_cb(EV_P_ struct ev_timer *w_, int revents)
> {
>    int cfd;
>    struct TimeSockMapper * w= (struct TimeSockMapper *)w_;
>    struct LocalOpcodeData * ldata = (struct LocalOpcodeData *) w->defPoint;
>    cfd=w->fd;
>
>    ev_timer_stop(loop,(ev_timer * )w);

No restart here.

> void set_timeout(int fd, long long seconds,LocalOpcodeData *ldata)
> {
>    TimeSockMapper *mtm=new TimeSockMapper();
>    mtm->repeat=0;
>    mtm->fd=fd;
>    mtm->defPoint=ldata;
>
>
>    ev_timer_init (&(mtm-> tm), timeout_cb, seconds, 0.);
>    ev_timer_set (&(mtm-> tm), seconds + ev_now (loop) - ev_time (), 0.);
>    ev_timer_start (loop,&(mtm->tm));
>

No restart here either.

If the timer indeed doesn't restart as you want, then you should show us
the code that actually resets the timer and restarts it - make sure you
stop the timer before modifying it, or, even better, use ev_timer_restart
and a suitable restart interval.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      [EMAIL PROTECTED]
      -=====/_/_//_/\_,_/ /_/\_\

_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to