sml_queue_internals.h
/*
* libsyncml - A syncml protocol implementation
* Copyright (C) 2005 Armin Bauer <armin.bauer@opensync.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _SML_QUEUE_INTERNALS_H_
#define _SML_QUEUE_INTERNALS_H_
typedef void (*SmlQueueHandler)(void *message, void *userdata);
typedef struct SmlQueue {
GList *head;
GList *tail;
GList *prio;
SmlQueueHandler handler;
void *userdata;
GSource *source;
GMainContext *context;
GSourceFuncs *functions;
GMutex *mutex;
} SmlQueue;
SmlQueue *smlQueueNew(SmlError **error);
void smlQueueFree(SmlQueue *queue);
void smlQueueFlush(SmlQueue *queue);
void smlQueueSetHandler(SmlQueue *queue, SmlQueueHandler handler, void *userdata);
void smlQueueSend(SmlQueue *queue, void *data);
void smlQueueAttach(SmlQueue *queue, GMainContext *context);
void smlQueueDetach(SmlQueue *queue);
void smlQueueDispatch(SmlQueue *queue);
void *smlQueueTryPop(SmlQueue *queue);
SmlBool smlQueueCheck(SmlQueue *queue);
void smlQueuePushHead(SmlQueue *queue, void *data);
SmlBool smlQueueIsAttached(SmlQueue *queue);
void smlQueueLock(SmlQueue *queue);
void smlQueueUnlock(SmlQueue *queue);
void *smlQueuePeek(SmlQueue *queue);
GList *smlQueuePeekNext(SmlQueue *queue, GList *prev);
void *smlQueueTryPopPrio(SmlQueue *queue);
void smlQueuePushHeadPrio(SmlQueue *queue, void *data);
void smlQueueSendPrio(SmlQueue *queue, void *data);
SmlBool smlQueueCheckPrio(SmlQueue *queue);
void smlQueueDispatchPrio(SmlQueue *queue);
void *smlQueuePeekPrio(SmlQueue *queue);
void smlQueuePrint(SmlQueue *queue);
unsigned int smlQueueLength(SmlQueue *queue);
unsigned int smlQueueLengthPrio(SmlQueue *queue);
#endif //_SML_QUEUE_INTERNALS_H_
SmlQueue::handler
SmlQueueHandler handler
Definition: sml_queue_internals.h:43
SmlQueue
struct SmlQueue SmlQueue
Represents a Queue which can be used to receive messages.
smlQueueSend
void smlQueueSend(SmlQueue *queue, void *data)
Sends a message down a queue.
Definition: sml_queue.c:353
smlQueueSetHandler
void smlQueueSetHandler(SmlQueue *queue, SmlQueueHandler handler, void *userdata)
Sets the message handler for a queue.
Definition: sml_queue.c:384
smlQueueNew
SmlQueue * smlQueueNew(SmlError **error)
Creates a new asynchronous queue.
Definition: sml_queue.c:81
SmlQueue::source
GSource * source
Definition: sml_queue_internals.h:47
SmlQueue::head
GList * head
Definition: sml_queue_internals.h:38
SmlQueue
Represents a Queue which can be used to receive messages.
Definition: sml_queue_internals.h:36
SmlQueue::context
GMainContext * context
Definition: sml_queue_internals.h:49
SmlQueue::userdata
void * userdata
Definition: sml_queue_internals.h:45
smlQueueAttach
void smlQueueAttach(SmlQueue *queue, GMainContext *context)
Sets the queue to use the gmainloop with the given context.
Definition: sml_queue.c:400
SmlError
Represent an error.
Definition: sml_error_internals.h:29
smlQueueSendPrio
void smlQueueSendPrio(SmlQueue *queue, void *data)
Sends a message down a queue.
Definition: sml_queue.c:323