1 /* concurrentlist.c generated by valac 0.18.0, the Vala compiler
2 * generated from concurrentlist.vala, do not modify */
6 * Copyright (C) 2011 Maciej Piechotka
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 * Maciej Piechotka <uzytkownik2@gmail.com>
27 #include <glib-object.h>
28 #include <gobject/gvaluecollector.h>
31 #define GEE_TYPE_TRAVERSABLE (gee_traversable_get_type ())
32 #define GEE_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversable))
33 #define GEE_IS_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TRAVERSABLE))
34 #define GEE_TRAVERSABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversableIface))
36 typedef struct _GeeTraversable GeeTraversable;
37 typedef struct _GeeTraversableIface GeeTraversableIface;
39 #define GEE_TRAVERSABLE_TYPE_STREAM (gee_traversable_stream_get_type ())
41 #define GEE_TYPE_LAZY (gee_lazy_get_type ())
42 #define GEE_LAZY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LAZY, GeeLazy))
43 #define GEE_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_LAZY, GeeLazyClass))
44 #define GEE_IS_LAZY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LAZY))
45 #define GEE_IS_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_LAZY))
46 #define GEE_LAZY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_LAZY, GeeLazyClass))
48 typedef struct _GeeLazy GeeLazy;
49 typedef struct _GeeLazyClass GeeLazyClass;
51 #define GEE_TYPE_ITERATOR (gee_iterator_get_type ())
52 #define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator))
53 #define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR))
54 #define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface))
56 typedef struct _GeeIterator GeeIterator;
57 typedef struct _GeeIteratorIface GeeIteratorIface;
59 #define GEE_TYPE_ITERABLE (gee_iterable_get_type ())
60 #define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable))
61 #define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE))
62 #define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface))
64 typedef struct _GeeIterable GeeIterable;
65 typedef struct _GeeIterableIface GeeIterableIface;
67 #define GEE_TYPE_COLLECTION (gee_collection_get_type ())
68 #define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection))
69 #define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION))
70 #define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface))
72 typedef struct _GeeCollection GeeCollection;
73 typedef struct _GeeCollectionIface GeeCollectionIface;
75 #define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ())
76 #define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection))
77 #define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass))
78 #define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION))
79 #define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION))
80 #define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass))
82 typedef struct _GeeAbstractCollection GeeAbstractCollection;
83 typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass;
84 typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate;
86 #define GEE_TYPE_LIST (gee_list_get_type ())
87 #define GEE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST, GeeList))
88 #define GEE_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST))
89 #define GEE_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST, GeeListIface))
91 typedef struct _GeeList GeeList;
92 typedef struct _GeeListIface GeeListIface;
94 #define GEE_TYPE_LIST_ITERATOR (gee_list_iterator_get_type ())
95 #define GEE_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIterator))
96 #define GEE_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST_ITERATOR))
97 #define GEE_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIteratorIface))
99 typedef struct _GeeListIterator GeeListIterator;
100 typedef struct _GeeListIteratorIface GeeListIteratorIface;
102 #define GEE_TYPE_ABSTRACT_LIST (gee_abstract_list_get_type ())
103 #define GEE_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractList))
104 #define GEE_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass))
105 #define GEE_IS_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_LIST))
106 #define GEE_IS_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_LIST))
107 #define GEE_ABSTRACT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass))
109 typedef struct _GeeAbstractList GeeAbstractList;
110 typedef struct _GeeAbstractListClass GeeAbstractListClass;
111 typedef struct _GeeAbstractListPrivate GeeAbstractListPrivate;
113 #define GEE_TYPE_CONCURRENT_LIST (gee_concurrent_list_get_type ())
114 #define GEE_CONCURRENT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_CONCURRENT_LIST, GeeConcurrentList))
115 #define GEE_CONCURRENT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_CONCURRENT_LIST, GeeConcurrentListClass))
116 #define GEE_IS_CONCURRENT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_CONCURRENT_LIST))
117 #define GEE_IS_CONCURRENT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_CONCURRENT_LIST))
118 #define GEE_CONCURRENT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_CONCURRENT_LIST, GeeConcurrentListClass))
120 typedef struct _GeeConcurrentList GeeConcurrentList;
121 typedef struct _GeeConcurrentListClass GeeConcurrentListClass;
122 typedef struct _GeeConcurrentListPrivate GeeConcurrentListPrivate;
124 #define GEE_CONCURRENT_LIST_TYPE_NODE (gee_concurrent_list_node_get_type ())
125 #define GEE_CONCURRENT_LIST_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_CONCURRENT_LIST_TYPE_NODE, GeeConcurrentListNode))
126 #define GEE_CONCURRENT_LIST_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_CONCURRENT_LIST_TYPE_NODE, GeeConcurrentListNodeClass))
127 #define GEE_CONCURRENT_LIST_IS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_CONCURRENT_LIST_TYPE_NODE))
128 #define GEE_CONCURRENT_LIST_IS_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_CONCURRENT_LIST_TYPE_NODE))
129 #define GEE_CONCURRENT_LIST_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_CONCURRENT_LIST_TYPE_NODE, GeeConcurrentListNodeClass))
131 typedef struct _GeeConcurrentListNode GeeConcurrentListNode;
132 typedef struct _GeeConcurrentListNodeClass GeeConcurrentListNodeClass;
134 #define GEE_HAZARD_POINTER_TYPE_POLICY (gee_hazard_pointer_policy_get_type ())
135 typedef struct _GeeHazardPointerContext GeeHazardPointerContext;
136 #define _gee_concurrent_list_node_unref0(var) ((var == NULL) ? NULL : (var = (gee_concurrent_list_node_unref (var), NULL)))
137 #define _gee_hazard_pointer_context_free0(var) ((var == NULL) ? NULL : (var = (gee_hazard_pointer_context_free (var), NULL)))
139 #define GEE_CONCURRENT_LIST_TYPE_STATE (gee_concurrent_list_state_get_type ())
140 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
142 #define GEE_CONCURRENT_LIST_TYPE_ITERATOR (gee_concurrent_list_iterator_get_type ())
143 #define GEE_CONCURRENT_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_CONCURRENT_LIST_TYPE_ITERATOR, GeeConcurrentListIterator))
144 #define GEE_CONCURRENT_LIST_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_CONCURRENT_LIST_TYPE_ITERATOR, GeeConcurrentListIteratorClass))
145 #define GEE_CONCURRENT_LIST_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_CONCURRENT_LIST_TYPE_ITERATOR))
146 #define GEE_CONCURRENT_LIST_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_CONCURRENT_LIST_TYPE_ITERATOR))
147 #define GEE_CONCURRENT_LIST_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_CONCURRENT_LIST_TYPE_ITERATOR, GeeConcurrentListIteratorClass))
149 typedef struct _GeeConcurrentListIterator GeeConcurrentListIterator;
150 typedef struct _GeeConcurrentListIteratorClass GeeConcurrentListIteratorClass;
151 typedef struct _GeeConcurrentListIteratorPrivate GeeConcurrentListIteratorPrivate;
152 typedef struct _GeeConcurrentListNodePrivate GeeConcurrentListNodePrivate;
153 #define _g_destroy_func0(var) (((var == NULL) || (g_destroy_func == NULL)) ? NULL : (var = (g_destroy_func (var), NULL)))
154 typedef struct _GeeConcurrentListParamSpecNode GeeConcurrentListParamSpecNode;
155 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
157 typedef gboolean (*GeeForallFunc) (gpointer g, void* user_data);
159 GEE_TRAVERSABLE_STREAM_YIELD,
160 GEE_TRAVERSABLE_STREAM_CONTINUE,
161 GEE_TRAVERSABLE_STREAM_END
162 } GeeTraversableStream;
164 typedef GeeTraversableStream (*GeeStreamFunc) (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, void* user_data);
165 struct _GeeIteratorIface {
166 GTypeInterface parent_iface;
167 gboolean (*next) (GeeIterator* self);
168 gboolean (*has_next) (GeeIterator* self);
169 gpointer (*get) (GeeIterator* self);
170 void (*remove) (GeeIterator* self);
171 gboolean (*get_valid) (GeeIterator* self);
172 gboolean (*get_read_only) (GeeIterator* self);
175 typedef gpointer (*GeeFoldFunc) (gpointer g, gpointer a, void* user_data);
176 typedef gpointer (*GeeMapFunc) (gpointer g, void* user_data);
177 typedef gboolean (*GeePredicate) (gconstpointer g, void* user_data);
178 struct _GeeTraversableIface {
179 GTypeInterface parent_iface;
180 GType (*get_g_type) (GeeTraversable* self);
181 GBoxedCopyFunc (*get_g_dup_func) (GeeTraversable* self);
182 GDestroyNotify (*get_g_destroy_func) (GeeTraversable* self);
183 gboolean (*foreach) (GeeTraversable* self, GeeForallFunc f, void* f_target);
184 GeeIterator* (*stream) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, void* f_target, GDestroyNotify f_target_destroy_notify);
185 gpointer (*fold) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
186 GeeIterator* (*map) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeMapFunc f, void* f_target);
187 GeeIterator* (*scan) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
188 GeeIterator* (*filter) (GeeTraversable* self, GeePredicate pred, void* pred_target, GDestroyNotify pred_target_destroy_notify);
189 GeeIterator* (*chop) (GeeTraversable* self, gint offset, gint length);
190 GType (*get_element_type) (GeeTraversable* self);
193 struct _GeeIterableIface {
194 GTypeInterface parent_iface;
195 GType (*get_g_type) (GeeIterable* self);
196 GBoxedCopyFunc (*get_g_dup_func) (GeeIterable* self);
197 GDestroyNotify (*get_g_destroy_func) (GeeIterable* self);
198 GeeIterator* (*iterator) (GeeIterable* self);
201 struct _GeeCollectionIface {
202 GTypeInterface parent_iface;
203 GType (*get_g_type) (GeeCollection* self);
204 GBoxedCopyFunc (*get_g_dup_func) (GeeCollection* self);
205 GDestroyNotify (*get_g_destroy_func) (GeeCollection* self);
206 gboolean (*contains) (GeeCollection* self, gconstpointer item);
207 gboolean (*add) (GeeCollection* self, gconstpointer item);
208 gboolean (*remove) (GeeCollection* self, gconstpointer item);
209 void (*clear) (GeeCollection* self);
210 gboolean (*add_all) (GeeCollection* self, GeeCollection* collection);
211 gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection);
212 gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection);
213 gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection);
214 gpointer* (*to_array) (GeeCollection* self, int* result_length1);
215 gint (*get_size) (GeeCollection* self);
216 gboolean (*get_is_empty) (GeeCollection* self);
217 gboolean (*get_read_only) (GeeCollection* self);
218 GeeCollection* (*get_read_only_view) (GeeCollection* self);
221 struct _GeeAbstractCollection {
222 GObject parent_instance;
223 GeeAbstractCollectionPrivate * priv;
226 struct _GeeAbstractCollectionClass {
227 GObjectClass parent_class;
228 gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item);
229 gboolean (*add) (GeeAbstractCollection* self, gconstpointer item);
230 gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item);
231 void (*clear) (GeeAbstractCollection* self);
232 GeeIterator* (*iterator) (GeeAbstractCollection* self);
233 gboolean (*foreach) (GeeAbstractCollection* self, GeeForallFunc f, void* f_target);
234 void (*reserved0) (GeeAbstractCollection* self);
235 void (*reserved1) (GeeAbstractCollection* self);
236 void (*reserved2) (GeeAbstractCollection* self);
237 void (*reserved3) (GeeAbstractCollection* self);
238 void (*reserved4) (GeeAbstractCollection* self);
239 void (*reserved5) (GeeAbstractCollection* self);
240 void (*reserved6) (GeeAbstractCollection* self);
241 void (*reserved7) (GeeAbstractCollection* self);
242 void (*reserved8) (GeeAbstractCollection* self);
243 void (*reserved9) (GeeAbstractCollection* self);
244 gint (*get_size) (GeeAbstractCollection* self);
245 gboolean (*get_read_only) (GeeAbstractCollection* self);
246 GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self);
249 struct _GeeListIteratorIface {
250 GTypeInterface parent_iface;
251 void (*set) (GeeListIterator* self, gconstpointer item);
252 void (*add) (GeeListIterator* self, gconstpointer item);
253 gint (*index) (GeeListIterator* self);
256 struct _GeeListIface {
257 GTypeInterface parent_iface;
258 GType (*get_g_type) (GeeList* self);
259 GBoxedCopyFunc (*get_g_dup_func) (GeeList* self);
260 GDestroyNotify (*get_g_destroy_func) (GeeList* self);
261 GeeListIterator* (*list_iterator) (GeeList* self);
262 gpointer (*get) (GeeList* self, gint index);
263 void (*set) (GeeList* self, gint index, gconstpointer item);
264 gint (*index_of) (GeeList* self, gconstpointer item);
265 void (*insert) (GeeList* self, gint index, gconstpointer item);
266 gpointer (*remove_at) (GeeList* self, gint index);
267 GeeList* (*slice) (GeeList* self, gint start, gint stop);
268 gpointer (*first) (GeeList* self);
269 gpointer (*last) (GeeList* self);
270 void (*insert_all) (GeeList* self, gint index, GeeCollection* collection);
271 void (*sort) (GeeList* self, GCompareDataFunc compare_func, void* compare_func_target, GDestroyNotify compare_func_target_destroy_notify);
272 GeeList* (*get_read_only_view) (GeeList* self);
275 struct _GeeAbstractList {
276 GeeAbstractCollection parent_instance;
277 GeeAbstractListPrivate * priv;
280 struct _GeeAbstractListClass {
281 GeeAbstractCollectionClass parent_class;
282 GeeListIterator* (*list_iterator) (GeeAbstractList* self);
283 gpointer (*get) (GeeAbstractList* self, gint index);
284 void (*set) (GeeAbstractList* self, gint index, gconstpointer item);
285 gint (*index_of) (GeeAbstractList* self, gconstpointer item);
286 void (*insert) (GeeAbstractList* self, gint index, gconstpointer item);
287 gpointer (*remove_at) (GeeAbstractList* self, gint index);
288 GeeList* (*slice) (GeeAbstractList* self, gint start, gint stop);
289 void (*reserved0) (GeeAbstractList* self);
290 void (*reserved1) (GeeAbstractList* self);
291 void (*reserved2) (GeeAbstractList* self);
292 void (*reserved3) (GeeAbstractList* self);
293 void (*reserved4) (GeeAbstractList* self);
294 void (*reserved5) (GeeAbstractList* self);
295 void (*reserved6) (GeeAbstractList* self);
296 void (*reserved7) (GeeAbstractList* self);
297 void (*reserved8) (GeeAbstractList* self);
298 void (*reserved9) (GeeAbstractList* self);
299 GeeList* (*get_read_only_view) (GeeAbstractList* self);
302 struct _GeeConcurrentList {
303 GeeAbstractList parent_instance;
304 GeeConcurrentListPrivate * priv;
307 struct _GeeConcurrentListClass {
308 GeeAbstractListClass parent_class;
311 typedef gboolean (*GeeEqualDataFunc) (gconstpointer a, gconstpointer b, void* user_data);
312 struct _GeeConcurrentListPrivate {
314 GBoxedCopyFunc g_dup_func;
315 GDestroyNotify g_destroy_func;
316 GeeEqualDataFunc _equal_func;
317 gpointer _equal_func_target;
318 GDestroyNotify _equal_func_target_destroy_notify;
319 GeeConcurrentListNode* _head;
320 GeeConcurrentListNode* _tail;
324 GEE_HAZARD_POINTER_POLICY_DEFAULT,
325 GEE_HAZARD_POINTER_POLICY_THREAD_EXIT,
326 GEE_HAZARD_POINTER_POLICY_TRY_FREE,
327 GEE_HAZARD_POINTER_POLICY_FREE,
328 GEE_HAZARD_POINTER_POLICY_TRY_RELEASE,
329 GEE_HAZARD_POINTER_POLICY_RELEASE
330 } GeeHazardPointerPolicy;
333 GEE_CONCURRENT_LIST_STATE_NONE = 0,
334 GEE_CONCURRENT_LIST_STATE_MARKED = 1,
335 GEE_CONCURRENT_LIST_STATE_FLAGGED = 2
336 } GeeConcurrentListState;
338 struct _GeeConcurrentListIterator {
339 GObject parent_instance;
340 GeeConcurrentListIteratorPrivate * priv;
343 struct _GeeConcurrentListIteratorClass {
344 GObjectClass parent_class;
347 struct _GeeConcurrentListIteratorPrivate {
349 GBoxedCopyFunc g_dup_func;
350 GDestroyNotify g_destroy_func;
353 GeeConcurrentListNode* _prev;
354 GeeConcurrentListNode* _curr;
357 struct _GeeConcurrentListNode {
358 GTypeInstance parent_instance;
359 volatile int ref_count;
360 GeeConcurrentListNodePrivate * priv;
361 GeeConcurrentListNode* _succ;
362 GeeConcurrentListNode* _backlink;
363 gconstpointer* _data;
366 struct _GeeConcurrentListNodeClass {
367 GTypeClass parent_class;
368 void (*finalize) (GeeConcurrentListNode *self);
371 struct _GeeConcurrentListNodePrivate {
373 GBoxedCopyFunc g_dup_func;
374 GDestroyNotify g_destroy_func;
377 struct _GeeConcurrentListParamSpecNode {
378 GParamSpec parent_instance;
382 static gpointer gee_concurrent_list_parent_class = NULL;
383 static gpointer gee_concurrent_list_iterator_parent_class = NULL;
384 static GeeTraversableIface* gee_concurrent_list_iterator_gee_traversable_parent_iface = NULL;
385 static GeeIteratorIface* gee_concurrent_list_iterator_gee_iterator_parent_iface = NULL;
386 static GeeListIteratorIface* gee_concurrent_list_iterator_gee_list_iterator_parent_iface = NULL;
387 static gpointer gee_concurrent_list_node_parent_class = NULL;
389 GType gee_traversable_stream_get_type (void) G_GNUC_CONST;
390 gpointer gee_lazy_ref (gpointer instance);
391 void gee_lazy_unref (gpointer instance);
392 GParamSpec* gee_param_spec_lazy (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
393 void gee_value_set_lazy (GValue* value, gpointer v_object);
394 void gee_value_take_lazy (GValue* value, gpointer v_object);
395 gpointer gee_value_get_lazy (const GValue* value);
396 GType gee_lazy_get_type (void) G_GNUC_CONST;
397 GType gee_iterator_get_type (void) G_GNUC_CONST;
398 GType gee_traversable_get_type (void) G_GNUC_CONST;
399 GType gee_iterable_get_type (void) G_GNUC_CONST;
400 GType gee_collection_get_type (void) G_GNUC_CONST;
401 GType gee_abstract_collection_get_type (void) G_GNUC_CONST;
402 GType gee_list_iterator_get_type (void) G_GNUC_CONST;
403 GType gee_list_get_type (void) G_GNUC_CONST;
404 GType gee_abstract_list_get_type (void) G_GNUC_CONST;
405 GType gee_concurrent_list_get_type (void) G_GNUC_CONST;
406 static gpointer gee_concurrent_list_node_ref (gpointer instance);
407 static void gee_concurrent_list_node_unref (gpointer instance);
408 static GParamSpec* gee_concurrent_list_param_spec_node (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) G_GNUC_UNUSED;
409 static void gee_concurrent_list_value_set_node (GValue* value, gpointer v_object) G_GNUC_UNUSED;
410 static void gee_concurrent_list_value_take_node (GValue* value, gpointer v_object) G_GNUC_UNUSED;
411 static gpointer gee_concurrent_list_value_get_node (const GValue* value) G_GNUC_UNUSED;
412 static GType gee_concurrent_list_node_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
413 #define GEE_CONCURRENT_LIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_CONCURRENT_LIST, GeeConcurrentListPrivate))
415 GEE_CONCURRENT_LIST_DUMMY_PROPERTY,
416 GEE_CONCURRENT_LIST_G_TYPE,
417 GEE_CONCURRENT_LIST_G_DUP_FUNC,
418 GEE_CONCURRENT_LIST_G_DESTROY_FUNC,
419 GEE_CONCURRENT_LIST_READ_ONLY,
420 GEE_CONCURRENT_LIST_SIZE,
421 GEE_CONCURRENT_LIST_IS_EMPTY
423 GType gee_hazard_pointer_policy_get_type (void) G_GNUC_CONST;
424 GeeHazardPointerContext* gee_hazard_pointer_context_new (GeeHazardPointerPolicy* policy);
425 GeeHazardPointerContext* gee_hazard_pointer_context_new (GeeHazardPointerPolicy* policy);
426 void gee_hazard_pointer_context_free (GeeHazardPointerContext* self);
427 void gee_hazard_pointer_set_pointer (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer** aptr, gpointer new_ptr, gsize mask, gsize new_mask);
428 static GType gee_concurrent_list_state_get_type (void) G_GNUC_UNUSED;
429 GeeConcurrentList* gee_concurrent_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeEqualDataFunc equal_func, void* equal_func_target, GDestroyNotify equal_func_target_destroy_notify);
430 GeeConcurrentList* gee_concurrent_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeEqualDataFunc equal_func, void* equal_func_target, GDestroyNotify equal_func_target_destroy_notify);
431 GeeAbstractList* gee_abstract_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func);
432 GeeEqualDataFunc gee_functions_get_equal_func_for (GType t, void** result_target, GDestroyNotify* result_target_destroy_notify);
433 static void gee_concurrent_list_set_equal_func (GeeConcurrentList* self, GeeEqualDataFunc value, gpointer value_target);
434 static GeeConcurrentListNode* gee_concurrent_list_node_new_head (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func);
435 static GeeConcurrentListNode* gee_concurrent_list_node_construct_head (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func);
436 static gboolean gee_concurrent_list_real_contains (GeeAbstractCollection* base, gconstpointer item);
437 GeeIterator* gee_abstract_collection_iterator (GeeAbstractCollection* self);
438 gboolean gee_iterator_next (GeeIterator* self);
439 GeeEqualDataFunc gee_concurrent_list_get_equal_func (GeeConcurrentList* self, gpointer* result_target);
440 gpointer gee_iterator_get (GeeIterator* self);
441 static gboolean gee_concurrent_list_real_add (GeeAbstractCollection* base, gconstpointer item);
442 static GeeConcurrentListNode* gee_concurrent_list_node_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data);
443 static GeeConcurrentListNode* gee_concurrent_list_node_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data);
444 static inline void gee_concurrent_list_node_insert (GeeConcurrentListNode* self, GeeConcurrentListNode* prev, GeeConcurrentListNode* next);
445 static inline GeeConcurrentListNode* gee_concurrent_list_get_tail (GeeConcurrentList* self);
446 static gboolean gee_concurrent_list_real_remove (GeeAbstractCollection* base, gconstpointer item);
447 void gee_iterator_remove (GeeIterator* self);
448 static void gee_concurrent_list_real_clear (GeeAbstractCollection* base);
449 static GeeIterator* gee_concurrent_list_real_iterator (GeeAbstractCollection* base);
450 static GeeConcurrentListIterator* gee_concurrent_list_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeConcurrentListNode* head);
451 static GeeConcurrentListIterator* gee_concurrent_list_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeConcurrentListNode* head);
452 static GType gee_concurrent_list_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
453 static GeeListIterator* gee_concurrent_list_real_list_iterator (GeeAbstractList* base);
454 static gpointer gee_concurrent_list_real_get (GeeAbstractList* base, gint index);
455 static void gee_concurrent_list_real_set (GeeAbstractList* base, gint index, gconstpointer item);
456 GeeListIterator* gee_abstract_list_list_iterator (GeeAbstractList* self);
457 void gee_list_iterator_set (GeeListIterator* self, gconstpointer item);
458 static gint gee_concurrent_list_real_index_of (GeeAbstractList* base, gconstpointer item);
459 static void gee_concurrent_list_real_insert (GeeAbstractList* base, gint index, gconstpointer item);
460 static inline GeeConcurrentListNode* gee_concurrent_list_node_get_next (GeeConcurrentListNode* self);
461 void gee_list_iterator_add (GeeListIterator* self, gconstpointer item);
462 static gpointer gee_concurrent_list_real_remove_at (GeeAbstractList* base, gint index);
463 static GeeList* gee_concurrent_list_real_slice (GeeAbstractList* base, gint start, gint end);
464 gboolean gee_abstract_collection_add (GeeAbstractCollection* self, gconstpointer item);
465 static inline GeeConcurrentListNode* gee_concurrent_list_update_tail (GeeConcurrentList* self);
466 gpointer gee_hazard_pointer_get_pointer (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer** aptr, gsize mask, gsize* mask_out);
467 static inline void gee_concurrent_list_node_backtrace (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeConcurrentListNode** curr);
468 static inline gboolean gee_concurrent_list_node_search_for (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeConcurrentListNode* goal, GeeConcurrentListNode** prev);
469 gboolean gee_concurrent_list_get_is_empty (GeeConcurrentList* self);
470 #define GEE_CONCURRENT_LIST_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_CONCURRENT_LIST_TYPE_ITERATOR, GeeConcurrentListIteratorPrivate))
472 GEE_CONCURRENT_LIST_ITERATOR_DUMMY_PROPERTY,
473 GEE_CONCURRENT_LIST_ITERATOR_G_TYPE,
474 GEE_CONCURRENT_LIST_ITERATOR_G_DUP_FUNC,
475 GEE_CONCURRENT_LIST_ITERATOR_G_DESTROY_FUNC,
476 GEE_CONCURRENT_LIST_ITERATOR_VALID,
477 GEE_CONCURRENT_LIST_ITERATOR_READ_ONLY
479 static gboolean gee_concurrent_list_iterator_real_next (GeeIterator* base);
480 static inline gboolean gee_concurrent_list_node_proceed (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeConcurrentListNode** prev, GeeConcurrentListNode** curr, gboolean force);
481 static gboolean gee_concurrent_list_iterator_real_has_next (GeeIterator* base);
482 static gpointer gee_concurrent_list_iterator_real_get (GeeIterator* base);
483 gboolean gee_iterator_get_valid (GeeIterator* self);
484 static void gee_concurrent_list_iterator_real_set (GeeListIterator* base, gconstpointer item);
485 static void gee_concurrent_list_iterator_real_remove (GeeIterator* base);
486 static inline gboolean gee_concurrent_list_node_remove (GeeConcurrentListNode* self, GeeConcurrentListNode* prev_node);
487 static gint gee_concurrent_list_iterator_real_index (GeeListIterator* base);
488 static void gee_concurrent_list_iterator_real_add (GeeListIterator* base, gconstpointer item);
489 static gboolean gee_concurrent_list_iterator_real_foreach (GeeTraversable* base, GeeForallFunc f, void* f_target);
490 static void gee_concurrent_list_iterator_finalize (GObject* obj);
491 gboolean gee_iterator_get_read_only (GeeIterator* self);
492 static void _vala_gee_concurrent_list_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
493 static void _vala_gee_concurrent_list_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
494 #define GEE_CONCURRENT_LIST_NODE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_CONCURRENT_LIST_TYPE_NODE, GeeConcurrentListNodePrivate))
496 GEE_CONCURRENT_LIST_NODE_DUMMY_PROPERTY
498 static inline GeeConcurrentListState gee_concurrent_list_node_get_state (GeeConcurrentListNode* self);
499 static inline GeeConcurrentListNode* gee_concurrent_list_node_get_succ (GeeConcurrentListNode* self, GeeConcurrentListState* state);
500 static inline void gee_concurrent_list_node_help_marked (GeeConcurrentListNode* self, GeeConcurrentListNode* prev_node);
501 static inline gboolean gee_concurrent_list_node_try_flag (GeeConcurrentListNode* self, GeeConcurrentListNode** prev_node);
502 static inline void gee_concurrent_list_node_help_flagged (GeeConcurrentListNode* self, GeeConcurrentListNode* prev);
503 static inline void gee_concurrent_list_node_set_succ (GeeConcurrentListNode* self, GeeConcurrentListNode* next, GeeConcurrentListState state);
504 static inline gboolean gee_concurrent_list_node_compare_and_exchange (GeeConcurrentListNode* self, GeeConcurrentListNode* old_node, GeeConcurrentListState old_state, GeeConcurrentListNode* new_node, GeeConcurrentListState new_state);
505 static inline void gee_concurrent_list_node_set_backlink (GeeConcurrentListNode* self, GeeConcurrentListNode* backlink);
506 static inline void gee_concurrent_list_node_try_mark (GeeConcurrentListNode* self);
507 static inline gboolean gee_concurrent_list_node_compare_succ (GeeConcurrentListNode* self, GeeConcurrentListNode* next, GeeConcurrentListState state);
508 static inline GeeConcurrentListNode* gee_concurrent_list_node_get_backlink (GeeConcurrentListNode* self);
509 gboolean gee_hazard_pointer_compare_and_exchange_pointer (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer** aptr, gconstpointer old_ptr, gpointer _new_ptr, gsize mask, gsize old_mask, gsize new_mask);
510 static void gee_concurrent_list_node_finalize (GeeConcurrentListNode* obj);
511 static void gee_concurrent_list_finalize (GObject* obj);
512 gboolean gee_abstract_collection_get_read_only (GeeAbstractCollection* self);
513 gint gee_abstract_collection_get_size (GeeAbstractCollection* self);
514 static void _vala_gee_concurrent_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
515 static void _vala_gee_concurrent_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
518 static GType gee_concurrent_list_state_get_type (void) {
519 static volatile gsize gee_concurrent_list_state_type_id__volatile = 0;
520 if (g_once_init_enter (&gee_concurrent_list_state_type_id__volatile)) {
521 static const GEnumValue values[] = {{GEE_CONCURRENT_LIST_STATE_NONE, "GEE_CONCURRENT_LIST_STATE_NONE", "none"}, {GEE_CONCURRENT_LIST_STATE_MARKED, "GEE_CONCURRENT_LIST_STATE_MARKED", "marked"}, {GEE_CONCURRENT_LIST_STATE_FLAGGED, "GEE_CONCURRENT_LIST_STATE_FLAGGED", "flagged"}, {0, NULL, NULL}};
522 GType gee_concurrent_list_state_type_id;
523 gee_concurrent_list_state_type_id = g_enum_register_static ("GeeConcurrentListState", values);
524 g_once_init_leave (&gee_concurrent_list_state_type_id__volatile, gee_concurrent_list_state_type_id);
526 return gee_concurrent_list_state_type_id__volatile;
531 * Construct new, empty single linked list
533 * If not provided, the function parameter is requested to the
534 * {@link Functions} function factory methods.
536 * @param equal_func an optional element equality testing function
538 static gpointer _gee_concurrent_list_node_ref0 (gpointer self) {
539 return self ? gee_concurrent_list_node_ref (self) : NULL;
543 GeeConcurrentList* gee_concurrent_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeEqualDataFunc equal_func, void* equal_func_target, GDestroyNotify equal_func_target_destroy_notify) {
544 GeeConcurrentList * self = NULL;
545 GeeEqualDataFunc _tmp0_;
547 GeeEqualDataFunc _tmp4_;
549 GDestroyNotify _tmp4__target_destroy_notify;
550 GeeEqualDataFunc _tmp5_;
552 GDestroyNotify _tmp5__target_destroy_notify;
553 GeeConcurrentListNode* _tmp6_;
554 GeeConcurrentListNode* _tmp7_;
555 GeeConcurrentListNode* _tmp8_;
556 self = (GeeConcurrentList*) gee_abstract_list_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func);
557 self->priv->g_type = g_type;
558 self->priv->g_dup_func = g_dup_func;
559 self->priv->g_destroy_func = g_destroy_func;
561 _tmp0__target = equal_func_target;
562 if (_tmp0_ == NULL) {
564 GDestroyNotify _tmp2_ = NULL;
565 GeeEqualDataFunc _tmp3_ = NULL;
566 _tmp3_ = gee_functions_get_equal_func_for (g_type, &_tmp1_, &_tmp2_);
567 (equal_func_target_destroy_notify == NULL) ? NULL : (equal_func_target_destroy_notify (equal_func_target), NULL);
569 equal_func_target = NULL;
570 equal_func_target_destroy_notify = NULL;
572 equal_func_target = _tmp1_;
573 equal_func_target_destroy_notify = _tmp2_;
576 _tmp4__target = equal_func_target;
577 _tmp4__target_destroy_notify = equal_func_target_destroy_notify;
578 equal_func_target_destroy_notify = NULL;
580 _tmp5__target = _tmp4__target;
581 _tmp5__target_destroy_notify = _tmp4__target_destroy_notify;
582 gee_concurrent_list_set_equal_func (self, _tmp5_, _tmp4__target);
583 (_tmp5__target_destroy_notify == NULL) ? NULL : (_tmp5__target_destroy_notify (_tmp5__target), NULL);
585 _tmp5__target = NULL;
586 _tmp5__target_destroy_notify = NULL;
587 _tmp6_ = gee_concurrent_list_node_new_head (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func);
588 _gee_concurrent_list_node_unref0 (self->priv->_head);
589 self->priv->_head = _tmp6_;
590 _tmp7_ = self->priv->_head;
591 _tmp8_ = _gee_concurrent_list_node_ref0 (_tmp7_);
592 gee_hazard_pointer_set_pointer (GEE_CONCURRENT_LIST_TYPE_NODE, (GBoxedCopyFunc) gee_concurrent_list_node_ref, gee_concurrent_list_node_unref, &self->priv->_tail, _tmp8_, (gsize) 0, (gsize) 0);
593 (equal_func_target_destroy_notify == NULL) ? NULL : (equal_func_target_destroy_notify (equal_func_target), NULL);
595 equal_func_target = NULL;
596 equal_func_target_destroy_notify = NULL;
601 GeeConcurrentList* gee_concurrent_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeEqualDataFunc equal_func, void* equal_func_target, GDestroyNotify equal_func_target_destroy_notify) {
602 return gee_concurrent_list_construct (GEE_TYPE_CONCURRENT_LIST, g_type, g_dup_func, g_destroy_func, equal_func, equal_func_target, equal_func_target_destroy_notify);
609 static gboolean gee_concurrent_list_real_contains (GeeAbstractCollection* base, gconstpointer item) {
610 GeeConcurrentList * self;
611 gboolean result = FALSE;
612 GeeHazardPointerContext* _tmp0_;
613 GeeHazardPointerContext* ctx;
614 self = (GeeConcurrentList*) base;
615 _tmp0_ = gee_hazard_pointer_context_new (NULL);
618 GeeIterator* _tmp1_ = NULL;
620 _tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
628 gboolean _tmp5_ = FALSE;
629 GeeEqualDataFunc _tmp6_;
631 GeeEqualDataFunc _tmp7_;
633 gconstpointer _tmp8_;
635 gpointer _tmp10_ = NULL;
637 gboolean _tmp12_ = FALSE;
644 _tmp5_ = gee_iterator_next (_tmp4_);
648 _tmp6_ = gee_concurrent_list_get_equal_func (self, &_tmp6__target);
650 _tmp7__target = _tmp6__target;
653 _tmp10_ = gee_iterator_get (_tmp9_);
655 _tmp12_ = _tmp7_ (_tmp8_, _tmp11_, _tmp7__target);
657 ((_tmp11_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp11_ = (self->priv->g_destroy_func (_tmp11_), NULL));
660 _g_object_unref0 (iter);
661 _gee_hazard_pointer_context_free0 (ctx);
666 _g_object_unref0 (iter);
669 _gee_hazard_pointer_context_free0 (ctx);
677 static gboolean gee_concurrent_list_real_add (GeeAbstractCollection* base, gconstpointer item) {
678 GeeConcurrentList * self;
679 gboolean result = FALSE;
680 GeeHazardPointerContext* _tmp0_;
681 GeeHazardPointerContext* ctx;
682 gconstpointer _tmp1_;
683 GeeConcurrentListNode* _tmp2_;
684 GeeConcurrentListNode* node;
685 GeeConcurrentListNode* _tmp3_ = NULL;
686 self = (GeeConcurrentList*) base;
687 _tmp0_ = gee_hazard_pointer_context_new (NULL);
690 _tmp2_ = gee_concurrent_list_node_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp1_);
692 _tmp3_ = gee_concurrent_list_get_tail (self);
693 gee_concurrent_list_node_insert (node, _tmp3_, NULL);
695 _gee_concurrent_list_node_unref0 (node);
696 _gee_hazard_pointer_context_free0 (ctx);
704 static gboolean gee_concurrent_list_real_remove (GeeAbstractCollection* base, gconstpointer item) {
705 GeeConcurrentList * self;
706 gboolean result = FALSE;
707 GeeHazardPointerContext* _tmp0_;
708 GeeHazardPointerContext* ctx;
709 GeeIterator* _tmp1_ = NULL;
711 self = (GeeConcurrentList*) base;
712 _tmp0_ = gee_hazard_pointer_context_new (NULL);
714 _tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
718 gboolean _tmp3_ = FALSE;
719 GeeEqualDataFunc _tmp4_;
721 GeeEqualDataFunc _tmp5_;
723 gconstpointer _tmp6_;
725 gpointer _tmp8_ = NULL;
727 gboolean _tmp10_ = FALSE;
730 _tmp3_ = gee_iterator_next (_tmp2_);
734 _tmp4_ = gee_concurrent_list_get_equal_func (self, &_tmp4__target);
736 _tmp5__target = _tmp4__target;
739 _tmp8_ = gee_iterator_get (_tmp7_);
741 _tmp10_ = _tmp5_ (_tmp6_, _tmp9_, _tmp5__target);
743 ((_tmp9_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp9_ = (self->priv->g_destroy_func (_tmp9_), NULL));
745 GeeIterator* _tmp12_;
747 gee_iterator_remove (_tmp12_);
749 _g_object_unref0 (iter);
750 _gee_hazard_pointer_context_free0 (ctx);
755 _g_object_unref0 (iter);
756 _gee_hazard_pointer_context_free0 (ctx);
764 static void gee_concurrent_list_real_clear (GeeAbstractCollection* base) {
765 GeeConcurrentList * self;
766 GeeHazardPointerContext* _tmp0_;
767 GeeHazardPointerContext* ctx;
768 GeeIterator* _tmp1_ = NULL;
770 GeeConcurrentListNode* _tmp5_;
771 GeeConcurrentListNode* _tmp6_;
772 self = (GeeConcurrentList*) base;
773 _tmp0_ = gee_hazard_pointer_context_new (NULL);
775 _tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
779 gboolean _tmp3_ = FALSE;
782 _tmp3_ = gee_iterator_next (_tmp2_);
787 gee_iterator_remove (_tmp4_);
789 _tmp5_ = self->priv->_head;
790 _tmp6_ = _gee_concurrent_list_node_ref0 (_tmp5_);
791 gee_hazard_pointer_set_pointer (GEE_CONCURRENT_LIST_TYPE_NODE, (GBoxedCopyFunc) gee_concurrent_list_node_ref, gee_concurrent_list_node_unref, &self->priv->_tail, _tmp6_, (gsize) 0, (gsize) 0);
792 _g_object_unref0 (iter);
793 _gee_hazard_pointer_context_free0 (ctx);
800 static GeeIterator* gee_concurrent_list_real_iterator (GeeAbstractCollection* base) {
801 GeeConcurrentList * self;
802 GeeIterator* result = NULL;
803 GeeConcurrentListNode* _tmp0_;
804 GeeConcurrentListIterator* _tmp1_;
805 self = (GeeConcurrentList*) base;
806 _tmp0_ = self->priv->_head;
807 _tmp1_ = gee_concurrent_list_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp0_);
808 result = (GeeIterator*) _tmp1_;
816 static GeeListIterator* gee_concurrent_list_real_list_iterator (GeeAbstractList* base) {
817 GeeConcurrentList * self;
818 GeeListIterator* result = NULL;
819 GeeConcurrentListNode* _tmp0_;
820 GeeConcurrentListIterator* _tmp1_;
821 self = (GeeConcurrentList*) base;
822 _tmp0_ = self->priv->_head;
823 _tmp1_ = gee_concurrent_list_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp0_);
824 result = (GeeListIterator*) _tmp1_;
832 static gpointer gee_concurrent_list_real_get (GeeAbstractList* base, gint index) {
833 GeeConcurrentList * self;
834 gpointer result = NULL;
835 GeeHazardPointerContext* _tmp0_;
836 GeeHazardPointerContext* ctx;
838 self = (GeeConcurrentList*) base;
839 _tmp0_ = gee_hazard_pointer_context_new (NULL);
842 _vala_assert (_tmp1_ >= 0, "index >= 0");
844 GeeIterator* _tmp2_ = NULL;
845 GeeIterator* iterator;
846 _tmp2_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
854 gboolean _tmp6_ = FALSE;
861 _tmp6_ = gee_iterator_next (_tmp5_);
869 gpointer _tmp9_ = NULL;
871 _tmp9_ = gee_iterator_get (_tmp8_);
873 _g_object_unref0 (iterator);
874 _gee_hazard_pointer_context_free0 (ctx);
879 _g_object_unref0 (iterator);
881 g_assert_not_reached ();
882 _gee_hazard_pointer_context_free0 (ctx);
889 static void gee_concurrent_list_real_set (GeeAbstractList* base, gint index, gconstpointer item) {
890 GeeConcurrentList * self;
891 GeeHazardPointerContext* _tmp0_;
892 GeeHazardPointerContext* ctx;
894 self = (GeeConcurrentList*) base;
895 _tmp0_ = gee_hazard_pointer_context_new (NULL);
898 _vala_assert (_tmp1_ >= 0, "index >= 0");
900 GeeListIterator* _tmp2_ = NULL;
901 GeeListIterator* iterator;
902 _tmp2_ = gee_abstract_list_list_iterator ((GeeAbstractList*) self);
909 GeeListIterator* _tmp5_;
910 gboolean _tmp6_ = FALSE;
917 _tmp6_ = gee_iterator_next ((GeeIterator*) _tmp5_);
924 GeeListIterator* _tmp8_;
925 gconstpointer _tmp9_;
928 gee_list_iterator_set (_tmp8_, _tmp9_);
929 _g_object_unref0 (iterator);
930 _gee_hazard_pointer_context_free0 (ctx);
935 _g_object_unref0 (iterator);
937 g_assert_not_reached ();
938 _gee_hazard_pointer_context_free0 (ctx);
945 static gint gee_concurrent_list_real_index_of (GeeAbstractList* base, gconstpointer item) {
946 GeeConcurrentList * self;
948 GeeHazardPointerContext* _tmp0_;
949 GeeHazardPointerContext* ctx;
951 self = (GeeConcurrentList*) base;
952 _tmp0_ = gee_hazard_pointer_context_new (NULL);
956 GeeListIterator* _tmp1_ = NULL;
957 GeeListIterator* iterator;
958 _tmp1_ = gee_abstract_list_list_iterator ((GeeAbstractList*) self);
965 GeeListIterator* _tmp5_;
966 gboolean _tmp6_ = FALSE;
967 GeeEqualDataFunc _tmp7_;
969 GeeEqualDataFunc _tmp8_;
971 gconstpointer _tmp9_;
972 GeeListIterator* _tmp10_;
973 gpointer _tmp11_ = NULL;
975 gboolean _tmp13_ = FALSE;
985 _tmp6_ = gee_iterator_next ((GeeIterator*) _tmp5_);
989 _tmp7_ = gee_concurrent_list_get_equal_func (self, &_tmp7__target);
991 _tmp8__target = _tmp7__target;
994 _tmp11_ = gee_iterator_get ((GeeIterator*) _tmp10_);
996 _tmp13_ = _tmp8_ (_tmp9_, _tmp12_, _tmp8__target);
998 ((_tmp12_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp12_ = (self->priv->g_destroy_func (_tmp12_), NULL));
1001 _g_object_unref0 (iterator);
1002 _gee_hazard_pointer_context_free0 (ctx);
1007 _g_object_unref0 (iterator);
1010 _gee_hazard_pointer_context_free0 (ctx);
1018 static void gee_concurrent_list_real_insert (GeeAbstractList* base, gint index, gconstpointer item) {
1019 GeeConcurrentList * self;
1020 GeeHazardPointerContext* _tmp0_;
1021 GeeHazardPointerContext* ctx;
1024 self = (GeeConcurrentList*) base;
1025 _tmp0_ = gee_hazard_pointer_context_new (NULL);
1028 _vala_assert (_tmp1_ >= 0, "index >= 0");
1031 GeeConcurrentListNode* _tmp3_;
1032 GeeConcurrentListNode* _tmp4_;
1033 GeeConcurrentListNode* prev;
1034 GeeConcurrentListNode* _tmp5_;
1035 GeeConcurrentListNode* _tmp6_ = NULL;
1036 GeeConcurrentListNode* next;
1037 gconstpointer _tmp7_;
1038 GeeConcurrentListNode* _tmp8_;
1039 GeeConcurrentListNode* new_node;
1040 GeeConcurrentListNode* _tmp9_;
1041 GeeConcurrentListNode* _tmp10_;
1042 GeeConcurrentListNode* _tmp11_;
1043 GeeConcurrentListNode* _tmp12_;
1044 _tmp3_ = self->priv->_head;
1045 _tmp4_ = _gee_concurrent_list_node_ref0 (_tmp3_);
1047 _tmp5_ = self->priv->_head;
1048 _tmp6_ = gee_concurrent_list_node_get_next (_tmp5_);
1051 _tmp8_ = gee_concurrent_list_node_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp7_);
1055 _tmp11_ = _gee_concurrent_list_node_ref0 (_tmp10_);
1057 gee_concurrent_list_node_insert (_tmp9_, _tmp11_, _tmp12_);
1058 _gee_concurrent_list_node_unref0 (new_node);
1059 _gee_concurrent_list_node_unref0 (next);
1060 _gee_concurrent_list_node_unref0 (prev);
1063 GeeListIterator* _tmp13_ = NULL;
1064 GeeListIterator* iterator;
1065 _tmp13_ = gee_abstract_list_list_iterator ((GeeAbstractList*) self);
1072 GeeListIterator* _tmp16_;
1073 gboolean _tmp17_ = FALSE;
1081 _tmp17_ = gee_iterator_next ((GeeIterator*) _tmp16_);
1086 index = _tmp18_ - 1;
1089 GeeListIterator* _tmp20_;
1090 gconstpointer _tmp21_;
1093 gee_list_iterator_add (_tmp20_, _tmp21_);
1094 _g_object_unref0 (iterator);
1095 _gee_hazard_pointer_context_free0 (ctx);
1100 _g_object_unref0 (iterator);
1102 g_assert_not_reached ();
1104 _gee_hazard_pointer_context_free0 (ctx);
1111 static gpointer gee_concurrent_list_real_remove_at (GeeAbstractList* base, gint index) {
1112 GeeConcurrentList * self;
1113 gpointer result = NULL;
1114 GeeHazardPointerContext* _tmp0_;
1115 GeeHazardPointerContext* ctx;
1116 self = (GeeConcurrentList*) base;
1117 _tmp0_ = gee_hazard_pointer_context_new (NULL);
1120 GeeListIterator* _tmp1_ = NULL;
1121 GeeListIterator* iterator;
1122 _tmp1_ = gee_abstract_list_list_iterator ((GeeAbstractList*) self);
1129 GeeListIterator* _tmp4_;
1130 gboolean _tmp5_ = FALSE;
1137 _tmp5_ = gee_iterator_next ((GeeIterator*) _tmp4_);
1144 GeeListIterator* _tmp7_;
1145 gpointer _tmp8_ = NULL;
1147 GeeListIterator* _tmp9_;
1149 _tmp8_ = gee_iterator_get ((GeeIterator*) _tmp7_);
1152 gee_iterator_remove ((GeeIterator*) _tmp9_);
1154 _g_object_unref0 (iterator);
1155 _gee_hazard_pointer_context_free0 (ctx);
1160 _g_object_unref0 (iterator);
1162 g_assert_not_reached ();
1163 _gee_hazard_pointer_context_free0 (ctx);
1170 static GeeList* gee_concurrent_list_real_slice (GeeAbstractList* base, gint start, gint end) {
1171 GeeConcurrentList * self;
1172 GeeList* result = NULL;
1173 GeeHazardPointerContext* _tmp0_;
1174 GeeHazardPointerContext* ctx;
1178 GeeEqualDataFunc _tmp4_;
1179 void* _tmp4__target;
1180 GeeEqualDataFunc _tmp5_;
1181 void* _tmp5__target;
1182 GeeConcurrentList* _tmp6_;
1183 GeeConcurrentList* list;
1184 GeeIterator* _tmp7_ = NULL;
1185 GeeIterator* iterator;
1189 self = (GeeConcurrentList*) base;
1190 _tmp0_ = gee_hazard_pointer_context_new (NULL);
1193 _vala_assert (0 <= _tmp1_, "0 <= start");
1196 _vala_assert (_tmp2_ <= _tmp3_, "start <= end");
1197 _tmp4_ = gee_concurrent_list_get_equal_func (self, &_tmp4__target);
1199 _tmp5__target = _tmp4__target;
1200 _tmp6_ = gee_concurrent_list_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp5_, _tmp5__target, NULL);
1202 _tmp7_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
1210 GeeIterator* _tmp11_;
1211 gboolean _tmp12_ = FALSE;
1212 gboolean _tmp13_ = FALSE;
1224 _tmp12_ = gee_iterator_next (_tmp11_);
1230 if (_tmp14_ >= _tmp15_) {
1235 _tmp13_ = _tmp16_ < _tmp17_;
1241 GeeConcurrentList* _tmp19_;
1242 GeeIterator* _tmp20_;
1243 gpointer _tmp21_ = NULL;
1247 _tmp21_ = gee_iterator_get (_tmp20_);
1249 gee_abstract_collection_add ((GeeAbstractCollection*) _tmp19_, _tmp22_);
1250 ((_tmp22_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp22_ = (self->priv->g_destroy_func (_tmp22_), NULL));
1256 if (_tmp23_ >= _tmp24_) {
1264 _vala_assert (_tmp25_ >= _tmp26_, "idx >= end");
1265 result = (GeeList*) list;
1266 _g_object_unref0 (iterator);
1267 _gee_hazard_pointer_context_free0 (ctx);
1272 static inline GeeConcurrentListNode* gee_concurrent_list_update_tail (GeeConcurrentList* self) {
1273 GeeConcurrentListNode* result = NULL;
1274 gpointer _tmp0_ = NULL;
1275 GeeConcurrentListNode* tail;
1276 GeeConcurrentListNode* _tmp1_;
1277 GeeConcurrentListNode* _tmp2_;
1278 g_return_val_if_fail (self != NULL, NULL);
1279 _tmp0_ = gee_hazard_pointer_get_pointer (GEE_CONCURRENT_LIST_TYPE_NODE, (GBoxedCopyFunc) gee_concurrent_list_node_ref, gee_concurrent_list_node_unref, &self->priv->_tail, (gsize) 0, NULL);
1280 tail = (GeeConcurrentListNode*) _tmp0_;
1281 gee_concurrent_list_node_backtrace (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &tail);
1282 gee_concurrent_list_node_search_for (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, NULL, &tail);
1284 _tmp2_ = _gee_concurrent_list_node_ref0 (_tmp1_);
1285 gee_hazard_pointer_set_pointer (GEE_CONCURRENT_LIST_TYPE_NODE, (GBoxedCopyFunc) gee_concurrent_list_node_ref, gee_concurrent_list_node_unref, &self->priv->_tail, _tmp2_, (gsize) 0, (gsize) 0);
1291 static inline GeeConcurrentListNode* gee_concurrent_list_get_tail (GeeConcurrentList* self) {
1292 GeeConcurrentListNode* result = NULL;
1293 GeeConcurrentListNode* _tmp0_ = NULL;
1294 g_return_val_if_fail (self != NULL, NULL);
1295 _tmp0_ = gee_concurrent_list_update_tail (self);
1301 GeeEqualDataFunc gee_concurrent_list_get_equal_func (GeeConcurrentList* self, gpointer* result_target) {
1302 GeeEqualDataFunc result;
1303 GeeEqualDataFunc _tmp0_;
1304 void* _tmp0__target;
1305 GeeEqualDataFunc _tmp1_;
1306 void* _tmp1__target;
1307 g_return_val_if_fail (self != NULL, NULL);
1308 _tmp0_ = self->priv->_equal_func;
1309 _tmp0__target = self->priv->_equal_func_target;
1311 _tmp1__target = _tmp0__target;
1312 *result_target = _tmp1__target;
1318 static void gee_concurrent_list_set_equal_func (GeeConcurrentList* self, GeeEqualDataFunc value, gpointer value_target) {
1319 GeeEqualDataFunc _tmp0_;
1320 void* _tmp0__target;
1321 g_return_if_fail (self != NULL);
1323 _tmp0__target = value_target;
1324 (self->priv->_equal_func_target_destroy_notify == NULL) ? NULL : (self->priv->_equal_func_target_destroy_notify (self->priv->_equal_func_target), NULL);
1325 self->priv->_equal_func = NULL;
1326 self->priv->_equal_func_target = NULL;
1327 self->priv->_equal_func_target_destroy_notify = NULL;
1328 self->priv->_equal_func = _tmp0_;
1329 self->priv->_equal_func_target = _tmp0__target;
1330 self->priv->_equal_func_target_destroy_notify = NULL;
1334 static gboolean gee_concurrent_list_real_get_read_only (GeeAbstractCollection* base) {
1336 GeeConcurrentList* self;
1337 self = (GeeConcurrentList*) base;
1343 static gint gee_concurrent_list_real_get_size (GeeAbstractCollection* base) {
1345 GeeConcurrentList* self;
1346 GeeHazardPointerContext* _tmp0_;
1347 GeeHazardPointerContext* ctx;
1350 self = (GeeConcurrentList*) base;
1351 _tmp0_ = gee_hazard_pointer_context_new (NULL);
1355 GeeIterator* _tmp1_ = NULL;
1357 _tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
1364 GeeIterator* _tmp4_;
1365 gboolean _tmp5_ = FALSE;
1372 _tmp5_ = gee_iterator_next (_tmp4_);
1377 _result_ = _tmp6_ + 1;
1380 _g_object_unref0 (iter);
1384 _gee_hazard_pointer_context_free0 (ctx);
1389 gboolean gee_concurrent_list_get_is_empty (GeeConcurrentList* self) {
1391 GeeIterator* _tmp0_ = NULL;
1392 GeeIterator* _tmp1_;
1393 gboolean _tmp2_ = FALSE;
1395 g_return_val_if_fail (self != NULL, FALSE);
1396 _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
1398 _tmp2_ = gee_iterator_next (_tmp1_);
1400 _g_object_unref0 (_tmp1_);
1406 static GeeConcurrentListIterator* gee_concurrent_list_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeConcurrentListNode* head) {
1407 GeeConcurrentListIterator * self = NULL;
1408 GeeConcurrentListNode* _tmp0_;
1409 GeeConcurrentListNode* _tmp1_;
1410 g_return_val_if_fail (head != NULL, NULL);
1411 self = (GeeConcurrentListIterator*) g_object_new (object_type, NULL);
1412 self->priv->g_type = g_type;
1413 self->priv->g_dup_func = g_dup_func;
1414 self->priv->g_destroy_func = g_destroy_func;
1415 self->priv->_removed = FALSE;
1416 self->priv->_index = -1;
1417 _gee_concurrent_list_node_unref0 (self->priv->_prev);
1418 self->priv->_prev = NULL;
1420 _tmp1_ = _gee_concurrent_list_node_ref0 (_tmp0_);
1421 _gee_concurrent_list_node_unref0 (self->priv->_curr);
1422 self->priv->_curr = _tmp1_;
1427 static GeeConcurrentListIterator* gee_concurrent_list_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeConcurrentListNode* head) {
1428 return gee_concurrent_list_iterator_construct (GEE_CONCURRENT_LIST_TYPE_ITERATOR, g_type, g_dup_func, g_destroy_func, head);
1432 static gboolean gee_concurrent_list_iterator_real_next (GeeIterator* base) {
1433 GeeConcurrentListIterator * self;
1434 gboolean result = FALSE;
1435 GeeHazardPointerContext* _tmp0_;
1436 GeeHazardPointerContext* ctx;
1437 GeeConcurrentListNode* _tmp1_ = NULL;
1439 GeeConcurrentListNode* _tmp4_;
1440 GeeConcurrentListNode* _tmp5_;
1441 GeeConcurrentListNode* _old_prev;
1442 gboolean _tmp6_ = FALSE;
1445 self = (GeeConcurrentListIterator*) base;
1446 _tmp0_ = gee_hazard_pointer_context_new (NULL);
1448 _tmp2_ = self->priv->_removed;
1450 GeeConcurrentListNode* _tmp3_;
1451 _tmp3_ = self->priv->_prev;
1457 _tmp5_ = _gee_concurrent_list_node_ref0 (_tmp4_);
1459 _tmp6_ = gee_concurrent_list_node_proceed (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &self->priv->_prev, &self->priv->_curr, FALSE);
1465 _tmp8_ = self->priv->_removed;
1467 GeeConcurrentListNode* _tmp9_;
1470 _gee_concurrent_list_node_unref0 (self->priv->_prev);
1471 self->priv->_prev = _tmp9_;
1473 self->priv->_removed = FALSE;
1474 _tmp10_ = self->priv->_index;
1475 self->priv->_index = _tmp10_ + 1;
1478 _gee_concurrent_list_node_unref0 (_old_prev);
1479 _gee_hazard_pointer_context_free0 (ctx);
1484 static gboolean gee_concurrent_list_iterator_real_has_next (GeeIterator* base) {
1485 GeeConcurrentListIterator * self;
1486 gboolean result = FALSE;
1487 GeeHazardPointerContext* _tmp0_;
1488 GeeHazardPointerContext* ctx;
1489 GeeConcurrentListNode* _tmp1_;
1490 GeeConcurrentListNode* _tmp2_;
1491 GeeConcurrentListNode* prev;
1492 GeeConcurrentListNode* _tmp3_;
1493 GeeConcurrentListNode* _tmp4_;
1494 GeeConcurrentListNode* curr;
1495 gboolean _tmp5_ = FALSE;
1496 self = (GeeConcurrentListIterator*) base;
1497 _tmp0_ = gee_hazard_pointer_context_new (NULL);
1499 _tmp1_ = self->priv->_prev;
1500 _tmp2_ = _gee_concurrent_list_node_ref0 (_tmp1_);
1502 _tmp3_ = self->priv->_curr;
1503 _tmp4_ = _gee_concurrent_list_node_ref0 (_tmp3_);
1505 _tmp5_ = gee_concurrent_list_node_proceed (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &prev, &curr, FALSE);
1507 _gee_concurrent_list_node_unref0 (curr);
1508 _gee_concurrent_list_node_unref0 (prev);
1509 _gee_hazard_pointer_context_free0 (ctx);
1514 static gpointer gee_concurrent_list_iterator_real_get (GeeIterator* base) {
1515 GeeConcurrentListIterator * self;
1516 gpointer result = NULL;
1517 GeeHazardPointerContext* _tmp0_;
1518 GeeHazardPointerContext* ctx;
1521 GeeConcurrentListNode* _tmp3_;
1522 gpointer _tmp4_ = NULL;
1523 self = (GeeConcurrentListIterator*) base;
1524 _tmp0_ = gee_hazard_pointer_context_new (NULL);
1526 _tmp1_ = gee_iterator_get_valid ((GeeIterator*) self);
1528 _vala_assert (_tmp2_, "valid");
1529 _tmp3_ = self->priv->_curr;
1530 _tmp4_ = gee_hazard_pointer_get_pointer (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &_tmp3_->_data, (gsize) 0, NULL);
1532 _gee_hazard_pointer_context_free0 (ctx);
1537 static void gee_concurrent_list_iterator_real_set (GeeListIterator* base, gconstpointer item) {
1538 GeeConcurrentListIterator * self;
1539 GeeHazardPointerContext* _tmp0_;
1540 GeeHazardPointerContext* ctx;
1543 GeeConcurrentListNode* _tmp3_;
1544 gconstpointer _tmp4_;
1546 self = (GeeConcurrentListIterator*) base;
1547 _tmp0_ = gee_hazard_pointer_context_new (NULL);
1549 _tmp1_ = gee_iterator_get_valid ((GeeIterator*) self);
1551 _vala_assert (_tmp2_, "valid");
1552 _tmp3_ = self->priv->_curr;
1554 _tmp5_ = ((_tmp4_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp4_) : ((gpointer) _tmp4_);
1555 gee_hazard_pointer_set_pointer (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &_tmp3_->_data, _tmp5_, (gsize) 0, (gsize) 0);
1556 _gee_hazard_pointer_context_free0 (ctx);
1560 static void gee_concurrent_list_iterator_real_remove (GeeIterator* base) {
1561 GeeConcurrentListIterator * self;
1562 GeeHazardPointerContext* _tmp0_;
1563 GeeHazardPointerContext* ctx;
1566 GeeConcurrentListNode* _tmp3_;
1567 GeeConcurrentListNode* _tmp4_;
1569 self = (GeeConcurrentListIterator*) base;
1570 _tmp0_ = gee_hazard_pointer_context_new (NULL);
1572 _tmp1_ = gee_iterator_get_valid ((GeeIterator*) self);
1574 _vala_assert (_tmp2_, "valid");
1575 _tmp3_ = self->priv->_curr;
1576 _tmp4_ = self->priv->_prev;
1577 gee_concurrent_list_node_remove (_tmp3_, _tmp4_);
1578 self->priv->_removed = TRUE;
1579 _tmp5_ = self->priv->_index;
1580 self->priv->_index = _tmp5_ - 1;
1581 _gee_hazard_pointer_context_free0 (ctx);
1585 static gint gee_concurrent_list_iterator_real_index (GeeListIterator* base) {
1586 GeeConcurrentListIterator * self;
1591 self = (GeeConcurrentListIterator*) base;
1592 _tmp0_ = gee_iterator_get_valid ((GeeIterator*) self);
1594 _vala_assert (_tmp1_, "valid");
1595 _tmp2_ = self->priv->_index;
1601 static void gee_concurrent_list_iterator_real_add (GeeListIterator* base, gconstpointer item) {
1602 GeeConcurrentListIterator * self;
1603 GeeHazardPointerContext* _tmp0_;
1604 GeeHazardPointerContext* ctx;
1607 gboolean _tmp3_ = FALSE;
1608 gconstpointer _tmp5_;
1609 GeeConcurrentListNode* _tmp6_;
1610 GeeConcurrentListNode* new_node;
1611 GeeConcurrentListNode* _tmp7_;
1612 GeeConcurrentListNode* _tmp8_;
1613 GeeConcurrentListNode* _tmp9_;
1614 GeeConcurrentListNode* _tmp10_;
1615 GeeConcurrentListNode* _tmp11_;
1617 self = (GeeConcurrentListIterator*) base;
1618 _tmp0_ = gee_hazard_pointer_context_new (NULL);
1620 _tmp1_ = gee_iterator_get_valid ((GeeIterator*) self);
1622 _vala_assert (_tmp2_, "valid");
1623 _tmp3_ = gee_concurrent_list_node_proceed (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &self->priv->_prev, &self->priv->_curr, FALSE);
1625 GeeConcurrentListNode* _tmp4_;
1626 _tmp4_ = self->priv->_curr;
1627 self->priv->_curr = NULL;
1628 _gee_concurrent_list_node_unref0 (self->priv->_prev);
1629 self->priv->_prev = _tmp4_;
1630 _gee_concurrent_list_node_unref0 (self->priv->_curr);
1631 self->priv->_curr = NULL;
1634 _tmp6_ = gee_concurrent_list_node_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp5_);
1637 _tmp8_ = self->priv->_prev;
1638 _tmp9_ = _gee_concurrent_list_node_ref0 (_tmp8_);
1639 _tmp10_ = self->priv->_curr;
1640 gee_concurrent_list_node_insert (_tmp7_, _tmp9_, _tmp10_);
1643 _gee_concurrent_list_node_unref0 (self->priv->_curr);
1644 self->priv->_curr = _tmp11_;
1645 _tmp12_ = self->priv->_index;
1646 self->priv->_index = _tmp12_ + 1;
1647 _gee_concurrent_list_node_unref0 (new_node);
1648 _gee_hazard_pointer_context_free0 (ctx);
1652 static gboolean gee_concurrent_list_iterator_real_foreach (GeeTraversable* base, GeeForallFunc f, void* f_target) {
1653 GeeConcurrentListIterator * self;
1654 gboolean result = FALSE;
1655 GeeHazardPointerContext* _tmp0_;
1656 GeeHazardPointerContext* ctx;
1657 gboolean _tmp1_ = FALSE;
1658 GeeConcurrentListNode* _tmp2_;
1660 GeeConcurrentListNode* _tmp9_ = NULL;
1662 GeeConcurrentListNode* _tmp12_;
1663 GeeConcurrentListNode* _tmp13_;
1664 GeeConcurrentListNode* _old_prev;
1665 self = (GeeConcurrentListIterator*) base;
1666 _tmp0_ = gee_hazard_pointer_context_new (NULL);
1668 _tmp2_ = self->priv->_prev;
1669 if (_tmp2_ != NULL) {
1671 _tmp3_ = self->priv->_removed;
1678 GeeForallFunc _tmp5_;
1679 void* _tmp5__target;
1680 GeeConcurrentListNode* _tmp6_;
1681 gpointer _tmp7_ = NULL;
1682 gboolean _tmp8_ = FALSE;
1684 _tmp5__target = f_target;
1685 _tmp6_ = self->priv->_curr;
1686 _tmp7_ = gee_hazard_pointer_get_pointer (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &_tmp6_->_data, (gsize) 0, NULL);
1687 _tmp8_ = _tmp5_ (_tmp7_, _tmp5__target);
1690 _gee_hazard_pointer_context_free0 (ctx);
1694 _tmp10_ = self->priv->_removed;
1696 GeeConcurrentListNode* _tmp11_;
1697 _tmp11_ = self->priv->_prev;
1703 _tmp13_ = _gee_concurrent_list_node_ref0 (_tmp12_);
1704 _old_prev = _tmp13_;
1706 gboolean _tmp14_ = FALSE;
1709 GeeForallFunc _tmp18_;
1710 void* _tmp18__target;
1711 GeeConcurrentListNode* _tmp19_;
1712 gpointer _tmp20_ = NULL;
1713 gboolean _tmp21_ = FALSE;
1714 _tmp14_ = gee_concurrent_list_node_proceed (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &self->priv->_prev, &self->priv->_curr, FALSE);
1718 _tmp15_ = self->priv->_removed;
1720 GeeConcurrentListNode* _tmp16_;
1721 _tmp16_ = _old_prev;
1723 _gee_concurrent_list_node_unref0 (self->priv->_prev);
1724 self->priv->_prev = _tmp16_;
1726 self->priv->_removed = FALSE;
1727 _tmp17_ = self->priv->_index;
1728 self->priv->_index = _tmp17_ + 1;
1730 _tmp18__target = f_target;
1731 _tmp19_ = self->priv->_curr;
1732 _tmp20_ = gee_hazard_pointer_get_pointer (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &_tmp19_->_data, (gsize) 0, NULL);
1733 _tmp21_ = _tmp18_ (_tmp20_, _tmp18__target);
1736 _gee_concurrent_list_node_unref0 (_old_prev);
1737 _gee_hazard_pointer_context_free0 (ctx);
1742 _gee_concurrent_list_node_unref0 (_old_prev);
1743 _gee_hazard_pointer_context_free0 (ctx);
1748 static gboolean gee_concurrent_list_iterator_real_get_valid (GeeIterator* base) {
1750 GeeConcurrentListIterator* self;
1751 GeeConcurrentListNode* _tmp0_;
1752 gboolean _tmp1_ = FALSE;
1753 GeeConcurrentListNode* _tmp2_;
1755 self = (GeeConcurrentListIterator*) base;
1756 _tmp0_ = self->priv->_curr;
1757 _vala_assert (_tmp0_ != NULL, "_curr != null");
1758 _tmp2_ = self->priv->_prev;
1759 if (_tmp2_ != NULL) {
1761 _tmp3_ = self->priv->_removed;
1772 static gboolean gee_concurrent_list_iterator_real_get_read_only (GeeIterator* base) {
1774 GeeConcurrentListIterator* self;
1775 self = (GeeConcurrentListIterator*) base;
1781 static void gee_concurrent_list_iterator_class_init (GeeConcurrentListIteratorClass * klass) {
1782 gee_concurrent_list_iterator_parent_class = g_type_class_peek_parent (klass);
1783 g_type_class_add_private (klass, sizeof (GeeConcurrentListIteratorPrivate));
1784 G_OBJECT_CLASS (klass)->get_property = _vala_gee_concurrent_list_iterator_get_property;
1785 G_OBJECT_CLASS (klass)->set_property = _vala_gee_concurrent_list_iterator_set_property;
1786 G_OBJECT_CLASS (klass)->finalize = gee_concurrent_list_iterator_finalize;
1787 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_CONCURRENT_LIST_ITERATOR_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
1788 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_CONCURRENT_LIST_ITERATOR_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
1789 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_CONCURRENT_LIST_ITERATOR_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
1790 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_CONCURRENT_LIST_ITERATOR_VALID, g_param_spec_boolean ("valid", "valid", "valid", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
1791 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_CONCURRENT_LIST_ITERATOR_READ_ONLY, g_param_spec_boolean ("read-only", "read-only", "read-only", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
1795 static GType gee_concurrent_list_iterator_gee_traversable_get_g_type (GeeConcurrentListIterator* self) {
1796 return self->priv->g_type;
1800 static GBoxedCopyFunc gee_concurrent_list_iterator_gee_traversable_get_g_dup_func (GeeConcurrentListIterator* self) {
1801 return self->priv->g_dup_func;
1805 static GDestroyNotify gee_concurrent_list_iterator_gee_traversable_get_g_destroy_func (GeeConcurrentListIterator* self) {
1806 return self->priv->g_destroy_func;
1810 static void gee_concurrent_list_iterator_gee_traversable_interface_init (GeeTraversableIface * iface) {
1811 gee_concurrent_list_iterator_gee_traversable_parent_iface = g_type_interface_peek_parent (iface);
1812 iface->foreach = (gboolean (*)(GeeTraversable*, GeeForallFunc, void*)) gee_concurrent_list_iterator_real_foreach;
1813 iface->get_g_type = (GType(*)(GeeTraversable*)) gee_concurrent_list_iterator_gee_traversable_get_g_type;
1814 iface->get_g_dup_func = (GBoxedCopyFunc(*)(GeeTraversable*)) gee_concurrent_list_iterator_gee_traversable_get_g_dup_func;
1815 iface->get_g_destroy_func = (GDestroyNotify(*)(GeeTraversable*)) gee_concurrent_list_iterator_gee_traversable_get_g_destroy_func;
1819 static void gee_concurrent_list_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) {
1820 gee_concurrent_list_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface);
1821 iface->next = (gboolean (*)(GeeIterator*)) gee_concurrent_list_iterator_real_next;
1822 iface->has_next = (gboolean (*)(GeeIterator*)) gee_concurrent_list_iterator_real_has_next;
1823 iface->get = (gpointer (*)(GeeIterator*)) gee_concurrent_list_iterator_real_get;
1824 iface->remove = (void (*)(GeeIterator*)) gee_concurrent_list_iterator_real_remove;
1825 iface->get_valid = gee_concurrent_list_iterator_real_get_valid;
1826 iface->get_read_only = gee_concurrent_list_iterator_real_get_read_only;
1830 static void gee_concurrent_list_iterator_gee_list_iterator_interface_init (GeeListIteratorIface * iface) {
1831 gee_concurrent_list_iterator_gee_list_iterator_parent_iface = g_type_interface_peek_parent (iface);
1832 iface->set = (void (*)(GeeListIterator*, gconstpointer)) gee_concurrent_list_iterator_real_set;
1833 iface->index = (gint (*)(GeeListIterator*)) gee_concurrent_list_iterator_real_index;
1834 iface->add = (void (*)(GeeListIterator*, gconstpointer)) gee_concurrent_list_iterator_real_add;
1838 static void gee_concurrent_list_iterator_instance_init (GeeConcurrentListIterator * self) {
1839 self->priv = GEE_CONCURRENT_LIST_ITERATOR_GET_PRIVATE (self);
1843 static void gee_concurrent_list_iterator_finalize (GObject* obj) {
1844 GeeConcurrentListIterator * self;
1845 self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_CONCURRENT_LIST_TYPE_ITERATOR, GeeConcurrentListIterator);
1846 _gee_concurrent_list_node_unref0 (self->priv->_prev);
1847 _gee_concurrent_list_node_unref0 (self->priv->_curr);
1848 G_OBJECT_CLASS (gee_concurrent_list_iterator_parent_class)->finalize (obj);
1852 static GType gee_concurrent_list_iterator_get_type (void) {
1853 static volatile gsize gee_concurrent_list_iterator_type_id__volatile = 0;
1854 if (g_once_init_enter (&gee_concurrent_list_iterator_type_id__volatile)) {
1855 static const GTypeInfo g_define_type_info = { sizeof (GeeConcurrentListIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_concurrent_list_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeConcurrentListIterator), 0, (GInstanceInitFunc) gee_concurrent_list_iterator_instance_init, NULL };
1856 static const GInterfaceInfo gee_traversable_info = { (GInterfaceInitFunc) gee_concurrent_list_iterator_gee_traversable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
1857 static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_concurrent_list_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
1858 static const GInterfaceInfo gee_list_iterator_info = { (GInterfaceInitFunc) gee_concurrent_list_iterator_gee_list_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
1859 GType gee_concurrent_list_iterator_type_id;
1860 gee_concurrent_list_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeConcurrentListIterator", &g_define_type_info, 0);
1861 g_type_add_interface_static (gee_concurrent_list_iterator_type_id, GEE_TYPE_TRAVERSABLE, &gee_traversable_info);
1862 g_type_add_interface_static (gee_concurrent_list_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info);
1863 g_type_add_interface_static (gee_concurrent_list_iterator_type_id, GEE_TYPE_LIST_ITERATOR, &gee_list_iterator_info);
1864 g_once_init_leave (&gee_concurrent_list_iterator_type_id__volatile, gee_concurrent_list_iterator_type_id);
1866 return gee_concurrent_list_iterator_type_id__volatile;
1870 static void _vala_gee_concurrent_list_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
1871 GeeConcurrentListIterator * self;
1872 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_CONCURRENT_LIST_TYPE_ITERATOR, GeeConcurrentListIterator);
1873 switch (property_id) {
1874 case GEE_CONCURRENT_LIST_ITERATOR_VALID:
1875 g_value_set_boolean (value, gee_iterator_get_valid ((GeeIterator*) self));
1877 case GEE_CONCURRENT_LIST_ITERATOR_READ_ONLY:
1878 g_value_set_boolean (value, gee_iterator_get_read_only ((GeeIterator*) self));
1881 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1887 static void _vala_gee_concurrent_list_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
1888 GeeConcurrentListIterator * self;
1889 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_CONCURRENT_LIST_TYPE_ITERATOR, GeeConcurrentListIterator);
1890 switch (property_id) {
1891 case GEE_CONCURRENT_LIST_ITERATOR_G_TYPE:
1892 self->priv->g_type = g_value_get_gtype (value);
1894 case GEE_CONCURRENT_LIST_ITERATOR_G_DUP_FUNC:
1895 self->priv->g_dup_func = g_value_get_pointer (value);
1897 case GEE_CONCURRENT_LIST_ITERATOR_G_DESTROY_FUNC:
1898 self->priv->g_destroy_func = g_value_get_pointer (value);
1901 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1907 static GeeConcurrentListNode* gee_concurrent_list_node_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data) {
1908 GeeConcurrentListNode* self = NULL;
1909 gconstpointer _tmp0_;
1913 gconstpointer* data_ptr;
1914 gconstpointer* _tmp3_;
1915 self = (GeeConcurrentListNode*) g_type_create_instance (object_type);
1916 self->priv->g_type = g_type;
1917 self->priv->g_dup_func = g_dup_func;
1918 self->priv->g_destroy_func = g_destroy_func;
1919 g_atomic_pointer_set ((volatile gpointer *) (&self->_succ), NULL);
1920 g_atomic_pointer_set ((volatile gpointer *) (&self->_backlink), NULL);
1922 _tmp1_ = ((_tmp0_ != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) _tmp0_) : ((gpointer) _tmp0_);
1929 g_atomic_pointer_set ((volatile gpointer *) (&self->_data), _tmp3_);
1930 _g_destroy_func0 (data_copy);
1935 static GeeConcurrentListNode* gee_concurrent_list_node_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data) {
1936 return gee_concurrent_list_node_construct (GEE_CONCURRENT_LIST_TYPE_NODE, g_type, g_dup_func, g_destroy_func, data);
1940 static GeeConcurrentListNode* gee_concurrent_list_node_construct_head (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) {
1941 GeeConcurrentListNode* self = NULL;
1942 self = (GeeConcurrentListNode*) g_type_create_instance (object_type);
1943 self->priv->g_type = g_type;
1944 self->priv->g_dup_func = g_dup_func;
1945 self->priv->g_destroy_func = g_destroy_func;
1946 g_atomic_pointer_set ((volatile gpointer *) (&self->_succ), NULL);
1947 g_atomic_pointer_set ((volatile gpointer *) (&self->_backlink), NULL);
1948 g_atomic_pointer_set ((volatile gpointer *) (&self->_data), NULL);
1953 static GeeConcurrentListNode* gee_concurrent_list_node_new_head (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) {
1954 return gee_concurrent_list_node_construct_head (GEE_CONCURRENT_LIST_TYPE_NODE, g_type, g_dup_func, g_destroy_func);
1958 static inline gboolean gee_concurrent_list_node_proceed (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeConcurrentListNode** prev, GeeConcurrentListNode** curr, gboolean force) {
1959 gboolean result = FALSE;
1960 GeeConcurrentListNode* _tmp0_;
1961 GeeConcurrentListNode* _tmp1_ = NULL;
1962 GeeConcurrentListNode* next;
1963 GeeConcurrentListNode* _tmp22_;
1965 gboolean _tmp23_ = FALSE;
1968 g_return_val_if_fail (*curr != NULL, FALSE);
1970 _tmp1_ = gee_concurrent_list_node_get_next (_tmp0_);
1973 GeeConcurrentListNode* _tmp2_;
1974 GeeConcurrentListNode* _tmp3_;
1975 GeeConcurrentListState _tmp4_ = 0;
1976 GeeConcurrentListState next_state;
1977 GeeConcurrentListState curr_state = 0;
1978 GeeConcurrentListNode* _tmp5_;
1979 GeeConcurrentListState _tmp6_ = 0;
1980 GeeConcurrentListNode* _tmp7_ = NULL;
1981 GeeConcurrentListNode* curr_next;
1982 gboolean _tmp8_ = FALSE;
1983 GeeConcurrentListState _tmp9_;
1985 GeeConcurrentListNode* _tmp16_;
1986 GeeConcurrentListNode* _tmp17_;
1987 GeeConcurrentListNode* _tmp20_;
1988 GeeConcurrentListNode* _tmp21_;
1990 if (!(_tmp2_ != NULL)) {
1994 _tmp4_ = gee_concurrent_list_node_get_state (_tmp3_);
1995 next_state = _tmp4_;
1997 _tmp7_ = gee_concurrent_list_node_get_succ (_tmp5_, &_tmp6_);
1998 curr_state = _tmp6_;
2000 _tmp9_ = next_state;
2001 if (_tmp9_ != GEE_CONCURRENT_LIST_STATE_MARKED) {
2004 gboolean _tmp10_ = FALSE;
2005 GeeConcurrentListState _tmp11_;
2007 _tmp11_ = curr_state;
2008 if (_tmp11_ == GEE_CONCURRENT_LIST_STATE_MARKED) {
2009 GeeConcurrentListNode* _tmp12_;
2010 GeeConcurrentListNode* _tmp13_;
2011 _tmp12_ = curr_next;
2013 _tmp10_ = _tmp12_ == _tmp13_;
2022 _gee_concurrent_list_node_unref0 (curr_next);
2025 _tmp16_ = curr_next;
2027 if (_tmp16_ == _tmp17_) {
2028 GeeConcurrentListNode* _tmp18_;
2029 GeeConcurrentListNode* _tmp19_;
2032 gee_concurrent_list_node_help_marked (_tmp18_, _tmp19_);
2034 _tmp20_ = curr_next;
2035 _tmp21_ = _gee_concurrent_list_node_ref0 (_tmp20_);
2036 _gee_concurrent_list_node_unref0 (next);
2038 _gee_concurrent_list_node_unref0 (curr_next);
2041 success = _tmp22_ != NULL;
2052 GeeConcurrentListNode* _tmp27_;
2053 GeeConcurrentListNode* _tmp28_;
2056 _gee_concurrent_list_node_unref0 (*prev);
2060 _gee_concurrent_list_node_unref0 (*curr);
2064 _gee_concurrent_list_node_unref0 (next);
2069 static inline gboolean gee_concurrent_list_node_search_for (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeConcurrentListNode* goal, GeeConcurrentListNode** prev) {
2070 gboolean result = FALSE;
2071 GeeConcurrentListNode* _tmp0_;
2072 GeeConcurrentListNode* _tmp1_ = NULL;
2073 GeeConcurrentListNode* curr;
2074 GeeConcurrentListNode* _tmp10_;
2075 GeeConcurrentListNode* _tmp11_;
2077 _tmp1_ = gee_concurrent_list_node_get_next (_tmp0_);
2080 gboolean _tmp2_ = FALSE;
2081 gboolean _tmp3_ = FALSE;
2082 GeeConcurrentListNode* _tmp4_;
2083 GeeConcurrentListNode* _tmp5_;
2088 if (_tmp4_ != _tmp5_) {
2091 GeeConcurrentListNode* _tmp6_;
2093 _tmp3_ = _tmp6_ != NULL;
2097 gboolean _tmp8_ = FALSE;
2098 _tmp8_ = gee_concurrent_list_node_proceed (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, prev, &curr, TRUE);
2110 result = _tmp10_ == _tmp11_;
2111 _gee_concurrent_list_node_unref0 (curr);
2116 static inline gboolean gee_concurrent_list_node_remove (GeeConcurrentListNode* self, GeeConcurrentListNode* prev_node) {
2117 gboolean result = FALSE;
2118 GeeConcurrentListNode* _tmp0_;
2119 GeeConcurrentListNode* _tmp1_;
2120 GeeConcurrentListNode* prev;
2121 gboolean _tmp2_ = FALSE;
2123 GeeConcurrentListNode* _tmp3_;
2124 g_return_val_if_fail (self != NULL, FALSE);
2125 g_return_val_if_fail (prev_node != NULL, FALSE);
2127 _tmp1_ = _gee_concurrent_list_node_ref0 (_tmp0_);
2129 _tmp2_ = gee_concurrent_list_node_try_flag (self, &prev);
2132 if (_tmp3_ != NULL) {
2133 GeeConcurrentListNode* _tmp4_;
2135 gee_concurrent_list_node_help_flagged (self, _tmp4_);
2138 _gee_concurrent_list_node_unref0 (prev);
2143 static inline void gee_concurrent_list_node_insert (GeeConcurrentListNode* self, GeeConcurrentListNode* prev, GeeConcurrentListNode* next) {
2144 g_return_if_fail (self != NULL);
2145 g_return_if_fail (prev != NULL);
2147 GeeConcurrentListState prev_state = 0;
2148 GeeConcurrentListState _tmp0_ = 0;
2149 GeeConcurrentListNode* _tmp1_ = NULL;
2150 GeeConcurrentListNode* prev_next;
2151 GeeConcurrentListState _tmp2_;
2152 GeeConcurrentListNode* _tmp15_;
2153 _tmp1_ = gee_concurrent_list_node_get_succ (self, &_tmp0_);
2154 prev_state = _tmp0_;
2156 _tmp2_ = prev_state;
2157 if (_tmp2_ == GEE_CONCURRENT_LIST_STATE_FLAGGED) {
2158 GeeConcurrentListNode* _tmp3_;
2159 GeeConcurrentListNode* _tmp4_;
2162 gee_concurrent_list_node_help_flagged (_tmp3_, _tmp4_);
2164 GeeConcurrentListNode* _tmp5_;
2165 GeeConcurrentListNode* _tmp6_;
2166 GeeConcurrentListNode* _tmp7_;
2167 gboolean _tmp8_ = FALSE;
2170 GeeConcurrentListState _tmp10_ = 0;
2171 GeeConcurrentListNode* _tmp11_ = NULL;
2172 GeeConcurrentListState _tmp12_;
2174 gee_concurrent_list_node_set_succ (self, _tmp5_, GEE_CONCURRENT_LIST_STATE_NONE);
2177 _tmp8_ = gee_concurrent_list_node_compare_and_exchange (_tmp6_, _tmp7_, GEE_CONCURRENT_LIST_STATE_NONE, self, GEE_CONCURRENT_LIST_STATE_NONE);
2181 _gee_concurrent_list_node_unref0 (prev_next);
2182 _gee_concurrent_list_node_unref0 (prev);
2185 _tmp11_ = gee_concurrent_list_node_get_succ (self, &_tmp10_);
2186 prev_state = _tmp10_;
2187 _gee_concurrent_list_node_unref0 (prev_next);
2188 prev_next = _tmp11_;
2189 _tmp12_ = prev_state;
2190 if (_tmp12_ == GEE_CONCURRENT_LIST_STATE_FLAGGED) {
2191 GeeConcurrentListNode* _tmp13_;
2192 GeeConcurrentListNode* _tmp14_;
2193 _tmp13_ = prev_next;
2195 gee_concurrent_list_node_help_flagged (_tmp13_, _tmp14_);
2197 gee_concurrent_list_node_backtrace (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &prev);
2200 gee_concurrent_list_node_search_for (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp15_, &prev);
2201 _gee_concurrent_list_node_unref0 (prev_next);
2203 _gee_concurrent_list_node_unref0 (prev);
2207 static inline void gee_concurrent_list_node_help_flagged (GeeConcurrentListNode* self, GeeConcurrentListNode* prev) {
2208 GeeConcurrentListNode* _tmp0_;
2209 GeeConcurrentListState _tmp1_ = 0;
2210 GeeConcurrentListNode* _tmp2_;
2211 g_return_if_fail (self != NULL);
2212 g_return_if_fail (prev != NULL);
2214 gee_concurrent_list_node_set_backlink (self, _tmp0_);
2215 _tmp1_ = gee_concurrent_list_node_get_state (self);
2216 if (_tmp1_ != GEE_CONCURRENT_LIST_STATE_MARKED) {
2217 gee_concurrent_list_node_try_mark (self);
2220 gee_concurrent_list_node_help_marked (self, _tmp2_);
2224 static inline void gee_concurrent_list_node_try_mark (GeeConcurrentListNode* self) {
2225 g_return_if_fail (self != NULL);
2231 GeeConcurrentListNode* _tmp3_ = NULL;
2232 GeeConcurrentListNode* next_node;
2233 GeeConcurrentListNode* _tmp4_;
2234 GeeConcurrentListNode* _tmp5_;
2235 gboolean _tmp6_ = FALSE;
2240 GeeConcurrentListState _tmp2_ = 0;
2241 _tmp2_ = gee_concurrent_list_node_get_state (self);
2242 if (!(_tmp2_ != GEE_CONCURRENT_LIST_STATE_MARKED)) {
2247 _tmp3_ = gee_concurrent_list_node_get_next (self);
2251 _tmp6_ = gee_concurrent_list_node_compare_and_exchange (self, _tmp4_, GEE_CONCURRENT_LIST_STATE_NONE, _tmp5_, GEE_CONCURRENT_LIST_STATE_MARKED);
2255 GeeConcurrentListState state = 0;
2256 GeeConcurrentListState _tmp8_ = 0;
2257 GeeConcurrentListNode* _tmp9_ = NULL;
2258 GeeConcurrentListState _tmp10_;
2259 _tmp9_ = gee_concurrent_list_node_get_succ (self, &_tmp8_);
2261 _gee_concurrent_list_node_unref0 (next_node);
2264 if (_tmp10_ == GEE_CONCURRENT_LIST_STATE_FLAGGED) {
2265 GeeConcurrentListNode* _tmp11_;
2266 _tmp11_ = next_node;
2267 gee_concurrent_list_node_help_flagged (self, _tmp11_);
2270 _gee_concurrent_list_node_unref0 (next_node);
2276 static inline void gee_concurrent_list_node_help_marked (GeeConcurrentListNode* self, GeeConcurrentListNode* prev_node) {
2277 GeeConcurrentListNode* _tmp0_;
2278 GeeConcurrentListNode* _tmp1_ = NULL;
2279 GeeConcurrentListNode* _tmp2_;
2280 g_return_if_fail (self != NULL);
2281 g_return_if_fail (prev_node != NULL);
2283 _tmp1_ = gee_concurrent_list_node_get_next (self);
2285 gee_concurrent_list_node_compare_and_exchange (_tmp0_, self, GEE_CONCURRENT_LIST_STATE_FLAGGED, _tmp2_, GEE_CONCURRENT_LIST_STATE_NONE);
2286 _gee_concurrent_list_node_unref0 (_tmp2_);
2290 static inline gboolean gee_concurrent_list_node_try_flag (GeeConcurrentListNode* self, GeeConcurrentListNode** prev_node) {
2291 gboolean result = FALSE;
2292 g_return_val_if_fail (self != NULL, FALSE);
2294 GeeConcurrentListNode* _tmp0_;
2295 gboolean _tmp1_ = FALSE;
2296 GeeConcurrentListNode* _tmp2_;
2297 gboolean _tmp3_ = FALSE;
2300 GeeConcurrentListState result_state = 0;
2301 GeeConcurrentListNode* _tmp5_;
2302 GeeConcurrentListState _tmp6_ = 0;
2303 GeeConcurrentListNode* _tmp7_ = NULL;
2304 GeeConcurrentListNode* result_node;
2305 gboolean _tmp8_ = FALSE;
2306 GeeConcurrentListNode* _tmp9_;
2308 gboolean _tmp12_ = FALSE;
2309 _tmp0_ = *prev_node;
2310 _tmp1_ = gee_concurrent_list_node_compare_succ (_tmp0_, self, GEE_CONCURRENT_LIST_STATE_FLAGGED);
2315 _tmp2_ = *prev_node;
2316 _tmp3_ = gee_concurrent_list_node_compare_and_exchange (_tmp2_, self, GEE_CONCURRENT_LIST_STATE_NONE, self, GEE_CONCURRENT_LIST_STATE_FLAGGED);
2323 _tmp5_ = *prev_node;
2324 _tmp7_ = gee_concurrent_list_node_get_succ (_tmp5_, &_tmp6_);
2325 result_state = _tmp6_;
2326 result_node = _tmp7_;
2327 _tmp9_ = result_node;
2328 if (_tmp9_ == self) {
2329 GeeConcurrentListState _tmp10_;
2330 _tmp10_ = result_state;
2331 _tmp8_ = _tmp10_ == GEE_CONCURRENT_LIST_STATE_FLAGGED;
2338 _gee_concurrent_list_node_unref0 (result_node);
2341 gee_concurrent_list_node_backtrace (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, prev_node);
2342 _tmp12_ = gee_concurrent_list_node_search_for (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self, prev_node);
2344 _gee_concurrent_list_node_unref0 (*prev_node);
2347 _gee_concurrent_list_node_unref0 (result_node);
2350 _gee_concurrent_list_node_unref0 (result_node);
2355 static inline void gee_concurrent_list_node_backtrace (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeConcurrentListNode** curr) {
2357 GeeConcurrentListNode* _tmp0_;
2358 GeeConcurrentListState _tmp1_ = 0;
2359 GeeConcurrentListNode* _tmp2_;
2360 GeeConcurrentListNode* _tmp3_ = NULL;
2362 _tmp1_ = gee_concurrent_list_node_get_state (_tmp0_);
2363 if (!(_tmp1_ == GEE_CONCURRENT_LIST_STATE_MARKED)) {
2367 _tmp3_ = gee_concurrent_list_node_get_backlink (_tmp2_);
2368 _gee_concurrent_list_node_unref0 (*curr);
2374 static inline gboolean gee_concurrent_list_node_compare_and_exchange (GeeConcurrentListNode* self, GeeConcurrentListNode* old_node, GeeConcurrentListState old_state, GeeConcurrentListNode* new_node, GeeConcurrentListState new_state) {
2375 gboolean result = FALSE;
2376 GeeConcurrentListNode* _tmp0_;
2377 GeeConcurrentListNode* _tmp1_;
2378 GeeConcurrentListNode* _tmp2_;
2379 GeeConcurrentListState _tmp3_;
2380 GeeConcurrentListState _tmp4_;
2381 gboolean _tmp5_ = FALSE;
2382 g_return_val_if_fail (self != NULL, FALSE);
2385 _tmp2_ = _gee_concurrent_list_node_ref0 (_tmp1_);
2388 _tmp5_ = gee_hazard_pointer_compare_and_exchange_pointer (GEE_CONCURRENT_LIST_TYPE_NODE, (GBoxedCopyFunc) gee_concurrent_list_node_ref, gee_concurrent_list_node_unref, &self->_succ, _tmp0_, _tmp2_, (gsize) 3, (gsize) _tmp3_, (gsize) _tmp4_);
2394 static inline gboolean gee_concurrent_list_node_compare_succ (GeeConcurrentListNode* self, GeeConcurrentListNode* next, GeeConcurrentListState state) {
2395 gboolean result = FALSE;
2396 void* _tmp0_ = NULL;
2398 GeeConcurrentListNode* _tmp1_;
2399 GeeConcurrentListState _tmp2_;
2400 g_return_val_if_fail (self != NULL, FALSE);
2401 _tmp0_ = g_atomic_pointer_get ((volatile gpointer *) (&self->_succ));
2402 cur = (gsize) _tmp0_;
2405 result = cur == (((gsize) _tmp1_) | ((gsize) _tmp2_));
2410 static inline GeeConcurrentListNode* gee_concurrent_list_node_get_next (GeeConcurrentListNode* self) {
2411 GeeConcurrentListNode* result = NULL;
2412 GeeConcurrentListNode* _tmp0_ = NULL;
2413 g_return_val_if_fail (self != NULL, NULL);
2414 _tmp0_ = gee_concurrent_list_node_get_succ (self, NULL);
2420 static inline GeeConcurrentListState gee_concurrent_list_node_get_state (GeeConcurrentListNode* self) {
2421 GeeConcurrentListState result = 0;
2422 void* _tmp0_ = NULL;
2423 g_return_val_if_fail (self != NULL, 0);
2424 _tmp0_ = g_atomic_pointer_get ((volatile gpointer *) (&self->_succ));
2425 result = (GeeConcurrentListState) (((gsize) _tmp0_) & 3);
2430 static inline GeeConcurrentListNode* gee_concurrent_list_node_get_succ (GeeConcurrentListNode* self, GeeConcurrentListState* state) {
2431 GeeConcurrentListState _vala_state = 0;
2432 GeeConcurrentListNode* result = NULL;
2435 gpointer _tmp1_ = NULL;
2436 GeeConcurrentListNode* succ;
2437 GeeConcurrentListNode* _tmp2_;
2438 g_return_val_if_fail (self != NULL, NULL);
2439 _tmp1_ = gee_hazard_pointer_get_pointer (GEE_CONCURRENT_LIST_TYPE_NODE, (GBoxedCopyFunc) gee_concurrent_list_node_ref, gee_concurrent_list_node_unref, &self->_succ, (gsize) 3, &_tmp0_);
2441 succ = (GeeConcurrentListNode*) _tmp1_;
2442 _vala_state = (GeeConcurrentListState) rstate;
2446 _gee_concurrent_list_node_unref0 (succ);
2448 *state = _vala_state;
2454 static inline void gee_concurrent_list_node_set_succ (GeeConcurrentListNode* self, GeeConcurrentListNode* next, GeeConcurrentListState state) {
2455 GeeConcurrentListNode* _tmp0_;
2456 GeeConcurrentListNode* _tmp1_;
2457 GeeConcurrentListState _tmp2_;
2458 g_return_if_fail (self != NULL);
2460 _tmp1_ = _gee_concurrent_list_node_ref0 (_tmp0_);
2462 gee_hazard_pointer_set_pointer (GEE_CONCURRENT_LIST_TYPE_NODE, (GBoxedCopyFunc) gee_concurrent_list_node_ref, gee_concurrent_list_node_unref, &self->_succ, _tmp1_, (gsize) 3, (gsize) _tmp2_);
2466 static inline GeeConcurrentListNode* gee_concurrent_list_node_get_backlink (GeeConcurrentListNode* self) {
2467 GeeConcurrentListNode* result = NULL;
2468 gpointer _tmp0_ = NULL;
2469 g_return_val_if_fail (self != NULL, NULL);
2470 _tmp0_ = gee_hazard_pointer_get_pointer (GEE_CONCURRENT_LIST_TYPE_NODE, (GBoxedCopyFunc) gee_concurrent_list_node_ref, gee_concurrent_list_node_unref, &self->_backlink, (gsize) 0, NULL);
2471 result = (GeeConcurrentListNode*) _tmp0_;
2476 static inline void gee_concurrent_list_node_set_backlink (GeeConcurrentListNode* self, GeeConcurrentListNode* backlink) {
2477 GeeConcurrentListNode* _tmp0_;
2478 GeeConcurrentListNode* _tmp1_;
2479 g_return_if_fail (self != NULL);
2481 _tmp1_ = _gee_concurrent_list_node_ref0 (_tmp0_);
2482 gee_hazard_pointer_compare_and_exchange_pointer (GEE_CONCURRENT_LIST_TYPE_NODE, (GBoxedCopyFunc) gee_concurrent_list_node_ref, gee_concurrent_list_node_unref, &self->_backlink, NULL, _tmp1_, (gsize) 0, (gsize) 0, (gsize) 0);
2486 static void gee_concurrent_list_value_node_init (GValue* value) {
2487 value->data[0].v_pointer = NULL;
2491 static void gee_concurrent_list_value_node_free_value (GValue* value) {
2492 if (value->data[0].v_pointer) {
2493 gee_concurrent_list_node_unref (value->data[0].v_pointer);
2498 static void gee_concurrent_list_value_node_copy_value (const GValue* src_value, GValue* dest_value) {
2499 if (src_value->data[0].v_pointer) {
2500 dest_value->data[0].v_pointer = gee_concurrent_list_node_ref (src_value->data[0].v_pointer);
2502 dest_value->data[0].v_pointer = NULL;
2507 static gpointer gee_concurrent_list_value_node_peek_pointer (const GValue* value) {
2508 return value->data[0].v_pointer;
2512 static gchar* gee_concurrent_list_value_node_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
2513 if (collect_values[0].v_pointer) {
2514 GeeConcurrentListNode* object;
2515 object = collect_values[0].v_pointer;
2516 if (object->parent_instance.g_class == NULL) {
2517 return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
2518 } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
2519 return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
2521 value->data[0].v_pointer = gee_concurrent_list_node_ref (object);
2523 value->data[0].v_pointer = NULL;
2529 static gchar* gee_concurrent_list_value_node_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
2530 GeeConcurrentListNode** object_p;
2531 object_p = collect_values[0].v_pointer;
2533 return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
2535 if (!value->data[0].v_pointer) {
2537 } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
2538 *object_p = value->data[0].v_pointer;
2540 *object_p = gee_concurrent_list_node_ref (value->data[0].v_pointer);
2546 static GParamSpec* gee_concurrent_list_param_spec_node (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
2547 GeeConcurrentListParamSpecNode* spec;
2548 g_return_val_if_fail (g_type_is_a (object_type, GEE_CONCURRENT_LIST_TYPE_NODE), NULL);
2549 spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
2550 G_PARAM_SPEC (spec)->value_type = object_type;
2551 return G_PARAM_SPEC (spec);
2555 static gpointer gee_concurrent_list_value_get_node (const GValue* value) {
2556 g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_CONCURRENT_LIST_TYPE_NODE), NULL);
2557 return value->data[0].v_pointer;
2561 static void gee_concurrent_list_value_set_node (GValue* value, gpointer v_object) {
2562 GeeConcurrentListNode* old;
2563 g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_CONCURRENT_LIST_TYPE_NODE));
2564 old = value->data[0].v_pointer;
2566 g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_CONCURRENT_LIST_TYPE_NODE));
2567 g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
2568 value->data[0].v_pointer = v_object;
2569 gee_concurrent_list_node_ref (value->data[0].v_pointer);
2571 value->data[0].v_pointer = NULL;
2574 gee_concurrent_list_node_unref (old);
2579 static void gee_concurrent_list_value_take_node (GValue* value, gpointer v_object) {
2580 GeeConcurrentListNode* old;
2581 g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_CONCURRENT_LIST_TYPE_NODE));
2582 old = value->data[0].v_pointer;
2584 g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_CONCURRENT_LIST_TYPE_NODE));
2585 g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
2586 value->data[0].v_pointer = v_object;
2588 value->data[0].v_pointer = NULL;
2591 gee_concurrent_list_node_unref (old);
2596 static void gee_concurrent_list_node_class_init (GeeConcurrentListNodeClass * klass) {
2597 gee_concurrent_list_node_parent_class = g_type_class_peek_parent (klass);
2598 GEE_CONCURRENT_LIST_NODE_CLASS (klass)->finalize = gee_concurrent_list_node_finalize;
2599 g_type_class_add_private (klass, sizeof (GeeConcurrentListNodePrivate));
2603 static void gee_concurrent_list_node_instance_init (GeeConcurrentListNode * self) {
2604 self->priv = GEE_CONCURRENT_LIST_NODE_GET_PRIVATE (self);
2605 self->ref_count = 1;
2609 static void gee_concurrent_list_node_finalize (GeeConcurrentListNode* obj) {
2610 GeeConcurrentListNode * self;
2611 self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_CONCURRENT_LIST_TYPE_NODE, GeeConcurrentListNode);
2612 gee_hazard_pointer_set_pointer (GEE_CONCURRENT_LIST_TYPE_NODE, (GBoxedCopyFunc) gee_concurrent_list_node_ref, gee_concurrent_list_node_unref, &self->_succ, NULL, (gsize) 3, (gsize) 0);
2613 gee_hazard_pointer_set_pointer (GEE_CONCURRENT_LIST_TYPE_NODE, (GBoxedCopyFunc) gee_concurrent_list_node_ref, gee_concurrent_list_node_unref, &self->_backlink, NULL, (gsize) 0, (gsize) 0);
2614 gee_hazard_pointer_set_pointer (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &self->_data, NULL, (gsize) 0, (gsize) 0);
2618 static GType gee_concurrent_list_node_get_type (void) {
2619 static volatile gsize gee_concurrent_list_node_type_id__volatile = 0;
2620 if (g_once_init_enter (&gee_concurrent_list_node_type_id__volatile)) {
2621 static const GTypeValueTable g_define_type_value_table = { gee_concurrent_list_value_node_init, gee_concurrent_list_value_node_free_value, gee_concurrent_list_value_node_copy_value, gee_concurrent_list_value_node_peek_pointer, "p", gee_concurrent_list_value_node_collect_value, "p", gee_concurrent_list_value_node_lcopy_value };
2622 static const GTypeInfo g_define_type_info = { sizeof (GeeConcurrentListNodeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_concurrent_list_node_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeConcurrentListNode), 0, (GInstanceInitFunc) gee_concurrent_list_node_instance_init, &g_define_type_value_table };
2623 static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
2624 GType gee_concurrent_list_node_type_id;
2625 gee_concurrent_list_node_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GeeConcurrentListNode", &g_define_type_info, &g_define_type_fundamental_info, 0);
2626 g_once_init_leave (&gee_concurrent_list_node_type_id__volatile, gee_concurrent_list_node_type_id);
2628 return gee_concurrent_list_node_type_id__volatile;
2632 static gpointer gee_concurrent_list_node_ref (gpointer instance) {
2633 GeeConcurrentListNode* self;
2635 g_atomic_int_inc (&self->ref_count);
2640 static void gee_concurrent_list_node_unref (gpointer instance) {
2641 GeeConcurrentListNode* self;
2643 if (g_atomic_int_dec_and_test (&self->ref_count)) {
2644 GEE_CONCURRENT_LIST_NODE_GET_CLASS (self)->finalize (self);
2645 g_type_free_instance ((GTypeInstance *) self);
2650 static void gee_concurrent_list_class_init (GeeConcurrentListClass * klass) {
2651 gee_concurrent_list_parent_class = g_type_class_peek_parent (klass);
2652 g_type_class_add_private (klass, sizeof (GeeConcurrentListPrivate));
2653 GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_concurrent_list_real_contains;
2654 GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_concurrent_list_real_add;
2655 GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_concurrent_list_real_remove;
2656 GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_concurrent_list_real_clear;
2657 GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_concurrent_list_real_iterator;
2658 GEE_ABSTRACT_LIST_CLASS (klass)->list_iterator = gee_concurrent_list_real_list_iterator;
2659 GEE_ABSTRACT_LIST_CLASS (klass)->get = gee_concurrent_list_real_get;
2660 GEE_ABSTRACT_LIST_CLASS (klass)->set = gee_concurrent_list_real_set;
2661 GEE_ABSTRACT_LIST_CLASS (klass)->index_of = gee_concurrent_list_real_index_of;
2662 GEE_ABSTRACT_LIST_CLASS (klass)->insert = gee_concurrent_list_real_insert;
2663 GEE_ABSTRACT_LIST_CLASS (klass)->remove_at = gee_concurrent_list_real_remove_at;
2664 GEE_ABSTRACT_LIST_CLASS (klass)->slice = gee_concurrent_list_real_slice;
2665 GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_read_only = gee_concurrent_list_real_get_read_only;
2666 GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_concurrent_list_real_get_size;
2667 G_OBJECT_CLASS (klass)->get_property = _vala_gee_concurrent_list_get_property;
2668 G_OBJECT_CLASS (klass)->set_property = _vala_gee_concurrent_list_set_property;
2669 G_OBJECT_CLASS (klass)->finalize = gee_concurrent_list_finalize;
2670 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_CONCURRENT_LIST_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
2671 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_CONCURRENT_LIST_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
2672 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_CONCURRENT_LIST_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
2676 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_CONCURRENT_LIST_READ_ONLY, g_param_spec_boolean ("read-only", "read-only", "read-only", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
2680 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_CONCURRENT_LIST_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
2684 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_CONCURRENT_LIST_IS_EMPTY, g_param_spec_boolean ("is-empty", "is-empty", "is-empty", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
2688 static void gee_concurrent_list_instance_init (GeeConcurrentList * self) {
2689 self->priv = GEE_CONCURRENT_LIST_GET_PRIVATE (self);
2693 static void gee_concurrent_list_finalize (GObject* obj) {
2694 GeeConcurrentList * self;
2695 GeeHazardPointerContext* _tmp0_;
2696 GeeHazardPointerContext* ctx;
2697 self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_CONCURRENT_LIST, GeeConcurrentList);
2698 _tmp0_ = gee_hazard_pointer_context_new (NULL);
2700 _gee_concurrent_list_node_unref0 (self->priv->_head);
2701 self->priv->_head = NULL;
2702 gee_hazard_pointer_set_pointer (GEE_CONCURRENT_LIST_TYPE_NODE, (GBoxedCopyFunc) gee_concurrent_list_node_ref, gee_concurrent_list_node_unref, &self->priv->_tail, NULL, (gsize) 0, (gsize) 0);
2703 _gee_hazard_pointer_context_free0 (ctx);
2704 (self->priv->_equal_func_target_destroy_notify == NULL) ? NULL : (self->priv->_equal_func_target_destroy_notify (self->priv->_equal_func_target), NULL);
2705 self->priv->_equal_func = NULL;
2706 self->priv->_equal_func_target = NULL;
2707 self->priv->_equal_func_target_destroy_notify = NULL;
2708 _gee_concurrent_list_node_unref0 (self->priv->_head);
2709 G_OBJECT_CLASS (gee_concurrent_list_parent_class)->finalize (obj);
2714 * A single-linked list. This implementation is based on
2715 * [[http://www.cse.yorku.ca/~ruppert/papers/lfll.pdf|Mikhail Fomitchev and Eric Ruppert paper ]].
2717 * Many threads are allowed to operate on the same structure as well as modification
2718 * of structure during iteration is allowed. However the change may not be immidiatly
2719 * visible to other threads.
2721 GType gee_concurrent_list_get_type (void) {
2722 static volatile gsize gee_concurrent_list_type_id__volatile = 0;
2723 if (g_once_init_enter (&gee_concurrent_list_type_id__volatile)) {
2724 static const GTypeInfo g_define_type_info = { sizeof (GeeConcurrentListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_concurrent_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeConcurrentList), 0, (GInstanceInitFunc) gee_concurrent_list_instance_init, NULL };
2725 GType gee_concurrent_list_type_id;
2726 gee_concurrent_list_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_LIST, "GeeConcurrentList", &g_define_type_info, 0);
2727 g_once_init_leave (&gee_concurrent_list_type_id__volatile, gee_concurrent_list_type_id);
2729 return gee_concurrent_list_type_id__volatile;
2733 static void _vala_gee_concurrent_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
2734 GeeConcurrentList * self;
2735 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_CONCURRENT_LIST, GeeConcurrentList);
2736 switch (property_id) {
2737 case GEE_CONCURRENT_LIST_READ_ONLY:
2738 g_value_set_boolean (value, gee_abstract_collection_get_read_only ((GeeAbstractCollection*) self));
2740 case GEE_CONCURRENT_LIST_SIZE:
2741 g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self));
2743 case GEE_CONCURRENT_LIST_IS_EMPTY:
2744 g_value_set_boolean (value, gee_concurrent_list_get_is_empty (self));
2747 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2753 static void _vala_gee_concurrent_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
2754 GeeConcurrentList * self;
2755 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_CONCURRENT_LIST, GeeConcurrentList);
2756 switch (property_id) {
2757 case GEE_CONCURRENT_LIST_G_TYPE:
2758 self->priv->g_type = g_value_get_gtype (value);
2760 case GEE_CONCURRENT_LIST_G_DUP_FUNC:
2761 self->priv->g_dup_func = g_value_get_pointer (value);
2763 case GEE_CONCURRENT_LIST_G_DESTROY_FUNC:
2764 self->priv->g_destroy_func = g_value_get_pointer (value);
2767 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);