1.1 --- a/epoc32/include/stdapis/glib-2.0/glib/gasyncqueue.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/glib-2.0/glib/gasyncqueue.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,117 @@
1.4 -gasyncqueue.h
1.5 +/* GLIB - Library of useful routines for C programming
1.6 + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
1.7 + * Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
1.8 + *
1.9 + * This library is free software; you can redistribute it and/or
1.10 + * modify it under the terms of the GNU Lesser General Public
1.11 + * License as published by the Free Software Foundation; either
1.12 + * version 2 of the License, or (at your option) any later version.
1.13 + *
1.14 + * This library is distributed in the hope that it will be useful,
1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.17 + * Lesser General Public License for more details.
1.18 + *
1.19 + * You should have received a copy of the GNU Lesser General Public
1.20 + * License along with this library; if not, write to the
1.21 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1.22 + * Boston, MA 02111-1307, USA.
1.23 + */
1.24 +
1.25 +/*
1.26 + * Modified by the GLib Team and others 1997-2000. See the AUTHORS
1.27 + * file for a list of people on the GLib Team. See the ChangeLog
1.28 + * files for a list of changes. These files are distributed with
1.29 + * GLib at ftp://ftp.gtk.org/pub/gtk/.
1.30 + */
1.31 +
1.32 +#ifndef __G_ASYNCQUEUE_H__
1.33 +#define __G_ASYNCQUEUE_H__
1.34 +
1.35 +#include <_ansi.h>
1.36 +#include <glib/gthread.h>
1.37 +
1.38 +G_BEGIN_DECLS
1.39 +
1.40 +typedef struct _GAsyncQueue GAsyncQueue;
1.41 +
1.42 +/* Asyncronous Queues, can be used to communicate between threads */
1.43 +
1.44 +/* Get a new GAsyncQueue with the ref_count 1 */
1.45 +IMPORT_C GAsyncQueue* g_async_queue_new (void);
1.46 +
1.47 +/* Lock and unlock a GAsyncQueue. All functions lock the queue for
1.48 + * themselves, but in certain cirumstances you want to hold the lock longer,
1.49 + * thus you lock the queue, call the *_unlocked functions and unlock it again.
1.50 + */
1.51 +IMPORT_C void g_async_queue_lock (GAsyncQueue *queue);
1.52 +IMPORT_C void g_async_queue_unlock (GAsyncQueue *queue);
1.53 +
1.54 +/* Ref and unref the GAsyncQueue. */
1.55 +IMPORT_C GAsyncQueue* g_async_queue_ref (GAsyncQueue *queue);
1.56 +IMPORT_C void g_async_queue_unref (GAsyncQueue *queue);
1.57 +
1.58 +#ifndef G_DISABLE_DEPRECATED
1.59 +/* You don't have to hold the lock for calling *_ref and *_unref anymore. */
1.60 +IMPORT_C void g_async_queue_ref_unlocked (GAsyncQueue *queue);
1.61 +IMPORT_C void g_async_queue_unref_and_unlock (GAsyncQueue *queue);
1.62 +#endif /* !G_DISABLE_DEPRECATED */
1.63 +
1.64 +/* Push data into the async queue. Must not be NULL. */
1.65 +IMPORT_C void g_async_queue_push (GAsyncQueue *queue,
1.66 + gpointer data);
1.67 +IMPORT_C void g_async_queue_push_unlocked (GAsyncQueue *queue,
1.68 + gpointer data);
1.69 +
1.70 +IMPORT_C void g_async_queue_push_sorted (GAsyncQueue *queue,
1.71 + gpointer data,
1.72 + GCompareDataFunc func,
1.73 + gpointer user_data);
1.74 +IMPORT_C void g_async_queue_push_sorted_unlocked (GAsyncQueue *queue,
1.75 + gpointer data,
1.76 + GCompareDataFunc func,
1.77 + gpointer user_data);
1.78 +
1.79 +/* Pop data from the async queue. When no data is there, the thread is blocked
1.80 + * until data arrives.
1.81 + */
1.82 +IMPORT_C gpointer g_async_queue_pop (GAsyncQueue *queue);
1.83 +IMPORT_C gpointer g_async_queue_pop_unlocked (GAsyncQueue *queue);
1.84 +
1.85 +/* Try to pop data. NULL is returned in case of empty queue. */
1.86 +IMPORT_C gpointer g_async_queue_try_pop (GAsyncQueue *queue);
1.87 +IMPORT_C gpointer g_async_queue_try_pop_unlocked (GAsyncQueue *queue);
1.88 +
1.89 +
1.90 +
1.91 +/* Wait for data until at maximum until end_time is reached. NULL is returned
1.92 + * in case of empty queue.
1.93 + */
1.94 +IMPORT_C gpointer g_async_queue_timed_pop (GAsyncQueue *queue,
1.95 + GTimeVal *end_time);
1.96 +IMPORT_C gpointer g_async_queue_timed_pop_unlocked (GAsyncQueue *queue,
1.97 + GTimeVal *end_time);
1.98 +
1.99 +/* Return the length of the queue. Negative values mean that threads
1.100 + * are waiting, positve values mean that there are entries in the
1.101 + * queue. Actually this function returns the length of the queue minus
1.102 + * the number of waiting threads, g_async_queue_length == 0 could also
1.103 + * mean 'n' entries in the queue and 'n' thread waiting. Such can
1.104 + * happen due to locking of the queue or due to scheduling.
1.105 + */
1.106 +IMPORT_C gint g_async_queue_length (GAsyncQueue *queue);
1.107 +IMPORT_C gint g_async_queue_length_unlocked (GAsyncQueue *queue);
1.108 +IMPORT_C void g_async_queue_sort (GAsyncQueue *queue,
1.109 + GCompareDataFunc func,
1.110 + gpointer user_data);
1.111 +IMPORT_C void g_async_queue_sort_unlocked (GAsyncQueue *queue,
1.112 + GCompareDataFunc func,
1.113 + gpointer user_data);
1.114 +
1.115 +/* Private API */
1.116 +GMutex* _g_async_queue_get_mutex (GAsyncQueue *queue);
1.117 +
1.118 +G_END_DECLS
1.119 +
1.120 +#endif /* __G_ASYNCQUEUE_H__ */
1.121 +