chergert / iris

Message passing, Work-Stealing, Lock-Free, Dynamic Scheduling, and other buzzwords for GLib

This URL has Read+Write access

iris / iris / iris-rrobin.h
6ec819f7 » chergert 2009-04-06 Add lock-free round robin d... 1 /* iris-rrobin.h
2 *
3 * Copyright (C) 2009 Christian Hergert <chris@dronelabs.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
18 * 02110-1301 USA
19 */
20
21 #ifndef __IRIS_RROBIN_H__
22 #define __IRIS_RROBIN_H__
23
d2d77af7 » chergert 2009-04-16 Register IrisRRobin with th... 24 #include <glib-object.h>
6ec819f7 » chergert 2009-04-06 Add lock-free round robin d... 25
98254b4b » chergert 2009-04-11 Add more docs. 26 G_BEGIN_DECLS
6ec819f7 » chergert 2009-04-06 Add lock-free round robin d... 27
d2d77af7 » chergert 2009-04-16 Register IrisRRobin with th... 28 #define IRIS_TYPE_RROBIN (iris_rrobin_get_type())
29
42d899f8 » chergert 2009-09-19 Cleanup of the public API a... 30 typedef struct _IrisRRobin IrisRRobin;
31 typedef void (*IrisRRobinFunc) (gpointer data, gpointer user_data);
32 typedef gboolean (*IrisRRobinForeachFunc) (IrisRRobin *rrobin, gpointer data, gpointer user_data);
33
6ec819f7 » chergert 2009-04-06 Add lock-free round robin d... 34 struct _IrisRRobin
35 {
36 /*< private >*/
d2d77af7 » chergert 2009-04-16 Register IrisRRobin with th... 37 gint size;
38 volatile gint ref_count;
39 gint count;
40 guint active;
41 gpointer data[1];
6ec819f7 » chergert 2009-04-06 Add lock-free round robin d... 42 };
43
d2d77af7 » chergert 2009-04-16 Register IrisRRobin with th... 44 GType iris_rrobin_get_type (void) G_GNUC_CONST;
45 IrisRRobin* iris_rrobin_new (gint size);
46 IrisRRobin* iris_rrobin_ref (IrisRRobin *rrobin);
47 void iris_rrobin_unref (IrisRRobin *rrobin);
48
49 gboolean iris_rrobin_append (IrisRRobin *rrobin, gpointer data);
50 void iris_rrobin_remove (IrisRRobin *rrobin, gpointer data);
51 gboolean iris_rrobin_apply (IrisRRobin *rrobin, IrisRRobinFunc callback, gpointer user_data);
52 void iris_rrobin_foreach (IrisRRobin *rrobin, IrisRRobinForeachFunc callback, gpointer user_data);
6ec819f7 » chergert 2009-04-06 Add lock-free round robin d... 53
54 G_END_DECLS
55
56 #endif /* __IRIS_RROBIN_H__ */