More AsyncWorker news

I completed some documentation about AsyncWorker, I renamed the OAsyncWorkerItem to OAsyncWorkerTask, added support for the sched_setscheduler stuff and did some more fixes.

You can find the documentation online here. You can, of course, also build the documentation yourself (–enable-gtk-doc).

I’m planning to do some sort of first release soon.

AsyncWorker is a library for doing asynchrone work queues in a GLib-style.

It makes it easy to queue worker functions and to launch a callback when work is finished, removed or cancelled (so that you can cleanup resources). It allows you to handle events like when a task got finished, cancelled or removed. Checkout an example here (note that it doesn’t to anything useful except showing how this stuff works).

It’s useful for applications like E-mail clients (who want to create a queue for for example retrieving E-mails and header-lists from a E-mail store like IMAP or POP3). Or for applications that do some sort of spooling or queue actions.

In case you are using a GMainLoop (like a Gtk+ userinterface mainloop), there’s support for cancellation of tasks. You can insert cancellation points in the body of your tasks. When such a task got cancelled by another context (for example by a userinterface event), the task will be aborted at the next cancellation point.

You don’t need to start or stop the queue. It will handle all that for you. By adding a task to the queue, it’ll make sure the task gets processed in a near future. You can also assign a priority to each task. Tasks with a high priority will get processed before tasks with a lower priority. Note, however, that running tasks can only be preempted at cancellation points. Also note that adding a new task, with a high priority, won’t preempt the current task. Even if the current task has a lower priority.