public
Description: Message passing, Work-Stealing, Lock-Free, Dynamic Scheduling, and other buzzwords for GLib
Homepage:
Clone URL: git://github.com/chergert/iris.git
chergert (author)
Wed Sep 23 22:59:57 -0700 2009
commit  36b7a5499c0923e5e697c7ea3033dbcd735b6d05
tree    cde11dffda17b70c839ef63db6d74e84638258ab
parent  75fcca0e799e0e1ee825f311bfb57b53839c4031
iris / iris / iris-rrobin.h
100644 57 lines (46 sloc) 1.957 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* iris-rrobin.h
*
* Copyright (C) 2009 Christian Hergert <chris@dronelabs.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
* 02110-1301 USA
*/
 
#ifndef __IRIS_RROBIN_H__
#define __IRIS_RROBIN_H__
 
#include <glib-object.h>
 
G_BEGIN_DECLS
 
#define IRIS_TYPE_RROBIN (iris_rrobin_get_type())
 
typedef struct _IrisRRobin IrisRRobin;
typedef void (*IrisRRobinFunc) (gpointer data, gpointer user_data);
typedef gboolean (*IrisRRobinForeachFunc) (IrisRRobin *rrobin, gpointer data, gpointer user_data);
 
struct _IrisRRobin
{
/*< private >*/
gint size;
volatile gint ref_count;
gint count;
guint active;
gpointer data[1];
};
 
GType iris_rrobin_get_type (void) G_GNUC_CONST;
IrisRRobin* iris_rrobin_new (gint size);
IrisRRobin* iris_rrobin_ref (IrisRRobin *rrobin);
void iris_rrobin_unref (IrisRRobin *rrobin);
 
gboolean iris_rrobin_append (IrisRRobin *rrobin, gpointer data);
void iris_rrobin_remove (IrisRRobin *rrobin, gpointer data);
gboolean iris_rrobin_apply (IrisRRobin *rrobin, IrisRRobinFunc callback, gpointer user_data);
void iris_rrobin_foreach (IrisRRobin *rrobin, IrisRRobinForeachFunc callback, gpointer user_data);
 
G_END_DECLS
 
#endif /* __IRIS_RROBIN_H__ */