gtk::events_pending() is useful when there is a function that needs to be carried out during a long-running process, for example, updating a status bar during an SQL query.
The way it would be used in such a situation is to have
<?php while(gtk::events_pending()) gtk::main_iteration(); ?>
See also: gtk::main_iteration() , gtk::main_iteration_do() , gtk::timeout_add() .