set_main_context


Description:

[ Version ( since = "6.0" ) ]
public void set_main_context (Thread? thread, MainContext? context)

Defines the MainContext which will still process events while a potentially blocking operation is performed using this.

If this is null, then this function applies to all the connections, except the ones for which a different context has been defined (be it user defined connections or internal connections used in other objects). On the other hand, if this is not null, then the setting only applied to this.

For exemple if there is a GUI which needs to continue to handle events, then you can use this function to pass the default MainContext used for the UI refreshing, for example:

<programlisting><![CDATA[GMainContext *context; cnc = gda_connection_new_...; context = g_main_context_ref_thread_default (); gda_connection_set_main_context (cnc, NULL, context); g_main_context_unref (context); GError *error = NULL; if (! gda_connection_open (cnc, &error)) ... ]]></programlisting>

If context is null, then potentially blocking operation will actually block any event from being processed while the blocking operation is being performed.

Parameters:

this

a Connection, or null

thread

the Thread in which context will be used, or null (for the current thread)

context

a MainContext, or null