Re: Does libev provide stop API of ev_once event?

2018-07-17 Thread Marc Lehmann
On Sat, Jul 14, 2018 at 01:43:07AM +0900, 裕士辻  wrote:
> I use ev_once, it's very convenience. But I have a problem about it.
> I seem there is no stop API for ev_once, isn't it?

No, there isn't. If you need the ability to stop watchers, you need to
create one with the other API functions.

I suggest you look at the implementation of ev_once in ev.c and roll your
own, as ev_once is close to trivial - it basically malloc's a struct with
an ev_timer and an ev_io watcher and starts them, freeing the struct when
the event fires.

Adding a stop API seemingly makes little sense, as ev_once is provided for
just those cases where you don't need this functionality, for everything
else you can use a normal watcher.

-- 
The choice of a   Deliantra, the free code+content MORPG
  -==- _GNU_  http://www.deliantra.net
  ==-- _   generation
  ---==---(_)__  __   __  Marc Lehmann
  --==---/ / _ \/ // /\ \/ /  schm...@schmorp.de
  -=/_/_//_/\_,_/ /_/\_\

___
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/mailman/listinfo/libev

Does libev provide stop API of ev_once event?

2018-07-17 Thread 裕士辻
Dear All.

I use ev_once, it's very convenience. But I have a problem about it.
I seem there is no stop API for ev_once, isn't it?
I have a case to stop ev_once event before publishing event. Can I do it
now?

If no, does libev support ev_once stop API?

Now I try to add following stop API sample to stop ev_once.

https://github.com/developer-kikikaikai/libev/commit/5cab98058a3f0ed22b259036fac182dda6c72a16

I look forward to your reply.
___
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/mailman/listinfo/libev