On Sun, Aug 26, 2012 at 09:55:42PM +0800, 钱晓明 <[email protected]> wrote:
> Hi, is ev_feed_event is thread safe?
As long as you call it on the same loop only in one thread at a time, yes.
> I have an ev_timer installed in a loop within main thread, can I call
> ev_feed_event in another thread to simulate the time out event?
Not without locking the event loop, e.g. with a mutex (you could use the
acquire/release callbacks and an ev_async watcher to lock/unlock and wake
up the loop).
> Is it safe?
Without proper locking, no, it will most likely corrupt libev's internal
data structures and not even work.
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / [email protected]
-=====/_/_//_/\_,_/ /_/\_\
_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev