set_dispose_function


Description:

[ Version ( since = "2.64" ) ]
public void set_dispose_function (SourceDisposeFunc dispose)

Set dispose as dispose function on this.

dispose will be called once the reference count of this reaches 0 but before any of the state of the source is freed, especially before the finalize function is called.

This means that at this point this is still a valid SignalSource and it is allow for the reference count to increase again until dispose returns.

The dispose function can be used to clear any "weak" references to the this in other data structures in a thread-safe way where it is possible for another thread to increase the reference count of this again while it is being freed.

The finalize function can not be used for this purpose as at that point this is already partially freed and not valid anymore.

This should only ever be called from SignalSource implementations.

Parameters:

this

A SignalSource to set the dispose function on

dispose

SourceDisposeFunc to set on the source