Hi; On 23 January 2017 at 22:09, rbd <r...@soest.hawaii.edu> wrote:
>> It is not quite that bad. The documentation for g_source_add_unix_fd() >> is inadequate, but although not immediately obvious the prepare, check >> and finalize handlers can in fact usually just be set to NULL (provided >> you have set the 'events' argument for g_source_add_unix_fd() >> correctly) so you only need to provide the dispatch handler, which >> executes your callback when an event occurs. >> >> The poor quality of the documentation is the real problem here. I >> would give it a try and see how you get on with it. > > > Nothing about the g_source_* functions is obvious from the official docs, > either immediately or otherwise! ;-> Seriously, one of the least illuminated > points there actually has to do with timeouts, exactly where in the > check->prepare->dispatch sequence the poll() gets done, etc. Of course, patches and bugs for the documentation are welcome. A good set of articles on GSource and the main context API in GLib is on Philip Withnall's blog; Philip actually contributed back that documentation in the API reference, but this kind of discussions on how the implementation works is ill-suited for an API documentation. See: - https://tecnocode.co.uk/2014/03/27/what-is-gmaincontext/ - https://tecnocode.co.uk/2015/05/05/a-detailed-look-at-gsource/ - https://tecnocode.co.uk/2014/04/19/ensuring-functions-are-called-in-the-right-context/ The second article also covers your use case pretty accurately. Ciao, Emmanuele. -- https://www.bassi.io [@] ebassi [@gmail.com] _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list