Re: more mainloops in more threads?

On Tue, Apr 1, 2008 at 3:38 PM, Roberto -MadBob- Guido
<bob4mail gmail com> wrote:
>  Hash: SHA1
>  Hello everyone.
>  After looking at documentation about mainloop implementation in Glib and doing
>  some search on the Net, I've not understood the relation (if any) on
>  mainloops and threads: can I run more loops in more threads? How to separate
>  them?

Make sure you declare a GMainContext for your mainloop in your
tread and use the proper varients for creating GSources.

>  My question is not only about handling of multiple GSources, expressed as file
>  descriptors to watch on the same time, but also GObjects and signalling:
>  given a thread, to which can be assigned a GMainContext as "owner" (if I not
>  badly undestand...), and creating on it a GObject, where it is managed? How
>  signals are dispatched between threads?: in a unique burst regardless of
>  contexts, only on the emitting thread, or what other?

A GObject is in your programs data, your threads share the same
data - signal emmissions are a synchronous affair, no weird surprises,
when a gtk+ api is called, all related signal callbacks are executed
*before* the gtk+ api in question returns.


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