attach_source


Description:

[ 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](iface.AsyncResult.html#io-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 on the task and the source doesn’t yet have a name.

This takes a reference on this until source is destroyed.

Parameters:

this

a Task

source

the source to attach

callback

the callback to invoke when source triggers