connect_raw


Description:

[ Version ( since = "4.2" ) ]
public ulong connect_raw (void* instance, string sig_name, bool private_thread, bool private_job, ThreadWrapperCallback callback)

Connects a callback function to a signal for a particular object.

The difference with connect and similar functions are:

  • the callback argument is not a ObjectConstructorFunc function, so the callback signature is not dependent on the signal itself
  • the signal handler must not have to return any value
  • the callback function will be called asynchronously, the caller may need to use iterate to get the notification
  • if private_job and private_thread control in which case the signal is propagated.

Also note that signal handling is done asynchronously: when emitted in the worker thread, it will be "queued" to be processed in the user thread when it has the chance (when iterate is called directly or indirectly). The side effect is that the callback function is usually called long after the object emitting the signal has finished emitting it.

To disconnect a signal handler, don't use any of the g_signal_handler_*() functions but the disconnect method.

Parameters:

this

a ThreadWrapper object

instance

the instance to connect to

sig_name

a string of the form "signal-name::detail"

private_thread

set to true if callback is to be invoked only if the signal has been emitted while in this's private sub thread (ie. used when this is executing some functions specified by execute or execute_void), and to false if the callback is to be invoked whenever the signal is emitted, independently of the thread in which the signal is emitted.

private_job

set to true if callback is to be invoked only if the signal has been emitted when a job created for the calling thread is being executed, and to false if callback has to be called whenever the sig_name signal is emitted by instance. Note that this argument is not taken into account if private_thread is set to false .

callback

a ThreadWrapperCallback function

data

data to pass to callback's calls

Returns:

the handler ID