GLib.SourceFuncs¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
check |
r |
Called after all the file descriptors are polled. The source should return |
|
closure_callback |
r |
||
closure_marshal |
r |
||
dispatch |
r |
Called to dispatch the event source, after it has returned |
|
finalize |
r |
Called when the source is finalized. At this point, the source will have been destroyed, had its callback cleared, and have been removed from its |
|
prepare |
r |
Called before all the file descriptors are polled. If the source can determine that it is ready here (without waiting for the results of the poll() call) it should return |
Methods¶
None
Details¶
- class GLib.SourceFuncs¶
The
GSourceFuncs
struct contains a table of functions used to handle event sources in a generic manner.For idle sources, the prepare and check functions always return
True
to indicate that the source is always ready to be processed. The prepare function also returns a timeout value of 0 to ensure that the poll() call doesn’t block (since that would be time wasted which could have been spent running the idle function).For timeout sources, the prepare and check functions both return
True
if the timeout interval has expired. The prepare function also returns a timeout value to ensure that the poll() call doesn’t block too long and miss the next timeout.For file descriptor sources, the prepare function typically returns
False
, since it must wait until poll() has been called before it knows whether any events need to be processed. It sets the returned timeout to -1 to indicate that it doesn’t mind how long the poll() call blocks. In the check function, it tests the results of the poll() call to see if the required condition has been met, and returnsTrue
if so.