#30 Refresh timer with out recreat thread

API
closed
nobody
General (24)
5
2010-01-23
2009-05-19
Yang Hong
No

I'm using libevent2, I need restart a evtimer before it expired, I do this by removed the old timer and refresh the timeval and add it back to event base.

When I use gdb to debug my application, I found every time I 'refresh' the timer, a thread was exited, and a new thread was created. I'll create more than 100 timer, and refresh them every 5 seconds, so I hope libevent can provider a new api and without recreate thread for it. such as:

evtimer_refresh (struct event *ev, struct timeval *tv);

any comments?

Discussion

  • Yang Hong
    Yang Hong
    2009-05-20

    It seem that because if there is no event in the base, call event_base_dispatch on the base will exit immediately, I should add a event into it before call dispatch...

     
  • Nick Mathewson
    Nick Mathewson
    2009-09-11

    First off, you can just call event_add() again to reset the timer to a new timeout; you don't need to delete it.

    Second, I don't think there's anything in libevent that creates threads. The only thread creation stuff is in event_iocp, and I don't think you're using that. Is there a small sample program that would demonstrate the thread thing you're seeing?

     
  • Nick Mathewson
    Nick Mathewson
    2010-01-15

    Hello? Any remaining feature requests here?

    (If I told you exactly what you needed to know, it would be good to know that you no longer are making this particular request. If you still think the request should be open, it would be good of you to say so.)

     
  • Nick Mathewson
    Nick Mathewson
    2010-01-23

    • status: open --> closed
     
  • Nick Mathewson
    Nick Mathewson
    2010-01-23

    No contact from user since last May. Closing.