Re: missing GMainContext methods ... (fwd)



On Fri, 2005-12-23 at 14:50 +0000, michael meeks wrote:

> 	The latter is the most troubling case; - where our stacks look s
> something like this:
> 
> 	obj->doMethod()		g_main_ctxt_iterate(); - waiting
> 	...
> 	g_main_ctxt_iterate()
> 
> 	So - in this case - we try to proxy the method across to the main
> thread - which we do - but, unfortunately that thread can never wakeup &
> execute the request since Thread B actually owns the context.
> So we really need a 'does_this_thread_own_the_context' call.
> 
> 	Now - of course we could call _acquire, then _release & execute the
> call in the current thread if we got the context, or proxy it to the
> main thread if we failed to get it - but there is a race with the latter
> scenario.

OK, I think I understand what you are doing; I'm not sure that I really
of iterating a context from two threads, but I can see where you might
want to do something different when you are temporarily playing the
role of "main thread".

> +/**
> + * g_main_context_is_owner:
> + * @context: a #GMainContext
> + * 
> + * Determines whether this thread holds the (recursive)
> + * ownership of this #GMaincontext. This is useful to
> + * know before waiting on another thread that may be
> + * blocking to get ownership of @context.

This looks simple and straightforward enough that I'm OK with it being
added even if it is very specialized.

Regards,
Owen


Attachment: signature.asc
Description: This is a digitally signed message part



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