Re: Multi-threaded light-server example



After instrumenting my code and printing out the thread ids I don't
believe either of these solutions are correct. I knew it wouldn't be
as simple as that (I was crossing my fingers GMainContext did some
magic). Can anyone point me to a reference to understand
g_main_context_push_thread_default better?

I've been reading these, but applying them to this example code has
been confusing:
https://tecnocode.co.uk/2014/03/27/what-is-gmaincontext/
http://gnome.soup.io/post/420776985/Philip-Withnall-Ensuring-functions-are-called-in

Any additional help would be greatly appreciated.

On Thu, Aug 18, 2016 at 10:36 AM, Nick Deubert <ndeubert gmail com> wrote:
On Thu, Aug 18, 2016 at 10:14 AM, Nick Deubert <ndeubert gmail com> wrote:
On Thu, Aug 18, 2016 at 3:28 AM, Jens Georg <mail jensge org> wrote:
Everything! GUPnP-related has to be created in the worker thread after
g_main_context_push_thread_default.

Otherwise half of your call-backs end up in main thread.


Thanks for the quick reply. Ok then is the attached code (which seems
to work) correct?
Thanks for your help.

Or I suppose do I even need the main loop in main()? Is it as simple
as just creating a GMainContext and pushing it before doing anything
else? Would the attached code be safe?
Thanks.


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