Re: Is g_source_remove threadsafe?



On Fri, 16 Nov 2007, Owen Taylor wrote:

While I don't really consider
g_source_remove(some_id_that_I_might_already_have_removed) 100% valid,
the docs do imply that it is legal, so perhaps it would be worth fixing
up that case (say, by having a referencing internal variant of
find_source_by_id().)

i think such a variant really needs to be exposed as public API.
g_main_context_find_source*() is fairly pointless if it can only be used
correctly if the caller must be holding a reference to the returned source
already.
i think this API should have in the first place, either:
- returned an id, because g_source_remove(invalid_id) behaves gracefully, or
- returned a GSource* with increased reference count, to ensure the returned
  pointer is alive and valid.

- Owen

---
ciaoTJ


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]