On Wed, Jan 5, 2011 at 5:30 PM, Gabriel Kerneis <[email protected]> wrote: > is it safe to copy a (potentially active or pending) watcher, destroy > the original one and use only the copy afterwards? > > (Or maybe my question should be: does libev retain pointers to > active/pending watchers?) > > I might have missed it but did not find anything about it in the manual.
I think it's not safe to do that. For one, when ev calls your callback, it passes a pointer to the watcher. If that wasn't enough, some watchers have structure members (eg. repeat in ev_timer) which the documentation guarantees you can safely modify any time, even if the watcher is active, so ev will definitely have to be able to access the watcher structure. I don't know whether it's safe to move a stopped watcher though. Ambrus _______________________________________________ libev mailing list [email protected] http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
