IIUC, the while(pending){iterate();} snippet is the main fix, while the rest of it is either sugar (eg qdata instead of data) or the pid tools branch, right?
Optional, I'd suggest extracting while(pending){iterate();} into an inline function to improve the readability a bit, eg flush_pending_events(GMainContext*). IMO this would also address thomas' comment on the readability of the /* may block */ comment
The code looks fine to me.
IIUC, the while(pending) {iterate( );} snippet is the main fix, while the rest of it is either sugar (eg qdata instead of data) or the pid tools branch, right?
Optional, I'd suggest extracting while(pending) {iterate( );} into an inline function to improve the readability a bit, eg flush_pending_ events( GMainContext* ). IMO this would also address thomas' comment on the readability of the /* may block */ comment