Today's Hot Hack

Posted by Ross Burton on November 7, 2007

Today I got fed up of writing yet another GQueue and idle function to perform tasks incrementally in the background, with all of the bookkeeping that needs to be done. So, I wrote taku_idle_queue_add.

Using it is simple, create a GQueue and then call taku_idle_queue_add, passing the queue and a callback function. When the queue has items in it, the callback gets called. Easy! Just remember not to return FALSE from the callback unless you are sure the queue will never be used again.

I'd appreciate anyone who knows GSource programming in detail to review the code. Maybe I should even try and get this into Glib?

NP: Cliqhop IDM, Soma.fm

tags: tasks, tech