Example

/* assuming queue is already initialized, and work_on_payload()
 * does something with the object consumed
 */

server_queue_entry_t    *head, *next;

if(server_queue_acquire(queue, 1, &head)) {

        for(; head != NULL; head = next) {
                next = head->next;

                work_on_payload(head->foo);

                server_heap_unit_unref(head);
        }
}

If you were using a SERVER_QUEUE_ENTRY_SUPPLIED queue, you would probably omit the server_heap_unit_unref(head); How you self-manage your queue entry memory is beyond the scope of this reference, but if thats what you want to do use SERVER_QUEUE_ENTRY_SUPPLIED.



2007-12-06