[ Version ( since = "2.36" ) ]
public void attach_source (Source source, TaskSourceFunc callback)
A utility function for dealing with async operations where you need to wait for a SocketSource to trigger.
Attaches source
to this's MainContext with
this's priority, and sets source
's callback to callback
, with
this as the callback's `user_data`.
It will set the source
’s name to the task’s name (as set with set_name
), if one has been set.
This takes a reference on this until source
is destroyed.
this |
a Task |
source |
the source to attach |
callback |
the callback to invoke when |