| Top |
| ITSignaler * | itsignaler_new () |
| SOCKET | itsignaler_windows_get_poll_fd () |
| int | itsignaler_unix_get_poll_fd () |
| ITSignaler * | itsignaler_ref () |
| void | itsignaler_unref () |
| gboolean | itsignaler_push_notification () |
| gpointer | itsignaler_pop_notification () |
| GSource * | itsignaler_create_source () |
| gboolean | (*ITSignalerFunc) () |
| guint | itsignaler_add () |
| gboolean | itsignaler_remove () |
ITSignaler *
itsignaler_new (void);
Creates a new ITSignaler object.
a new ITSignaler, or NULL if an error occurred. Use itsignaler_unref() when not needed anymore.
SOCKET
itsignaler_windows_get_poll_fd (ITSignaler *its);
Get the socket descriptor associated to its
.
int
itsignaler_unix_get_poll_fd (ITSignaler *its);
Get the file descriptor associated to its
.
ITSignaler *
itsignaler_ref (ITSignaler *its);
Increases the reference count of its
. If its
is NULL, then nothing happens.
This function can be called from any thread.
void
itsignaler_unref (ITSignaler *its);
Decrease the reference count of its
; when the rerefence count reaches zero, the object
is freed. If its
is NULL, then nothing happens.
This function can be called from any thread.
gboolean itsignaler_push_notification (ITSignaler *its,gpointer data,GDestroyNotify destroy_func);
Use this function to push a notification.
Note that data
will be passes AS-IS to the thread which calls itsignaler_pop_notification(), any memory allocation
must be handled correctly by the caller. However, in case itsignaler_unref() is called while there are still some
undelivered notifications, each notification's data will be freed using the destroy_func
which was specified when
itsignaler_push_notification() was called (note that no warning of any sort will be shown if destroy_func
is NULL
and some notification data should have been freed).
its |
a ITSignaler pointer |
|
data |
a pointer to some data. |
|
destroy_func |
a function to be called to free |
[allow-none] |
gpointer itsignaler_pop_notification (ITSignaler *its,gint timeout_ms);
Use this function from the thread to be signaled, to fetch any pending notification. If no notification is available,
then this function returns immediately NULL. It's up to the caller to free the returned data.
its |
a ITSignaler object |
|
timeout_ms |
if set to |
a pointer to some data which has been pushed by the notifying thread using itsignaler_push_notification(), or NULL
if no notification is present.
GSource *
itsignaler_create_source (ITSignaler *its);
Create a new GSource for its
.
The source will not initially be associated with any GMainContext and must be added to one
with g_source_attach() before it will be executed.
guint itsignaler_add (ITSignaler *its,GMainContext *context,ITSignalerFunc func,gpointer data,GDestroyNotify notify);
Have its
call func
(with data
) in the context of context
. Remove using itsignaler_remove(). This function
is similar to itsignaler_create_source() but is packaged for easier usage.
Use itsignaler_remove() to undo this function.
its |
a ITSignaler object |
|
context |
a GMainContext (if |
[allow-none] |
func |
callback function to be called when a notification is ready |
|
data |
data to pass to |
|
notify |
a function to call when data is no longer in use, or NULL. |
[allow-none] |
gboolean itsignaler_remove (ITSignaler *its,GMainContext *context,guint id);
Does the reverse of itsignaler_add().
its |
a ITSignaler object |
|
context |
a GMainContext (if NULL, the default context will be used). |
[allow-none] |
id |
the ID of the source as returned by |