Update Changelog
[profile/ivi/libgee.git] / gee / concurrentlist.c
1 /* concurrentlist.c generated by valac 0.18.0, the Vala compiler
2  * generated from concurrentlist.vala, do not modify */
3
4 /* concurrentlist.vala
5  *
6  * Copyright (C) 2011  Maciej Piechotka
7  *
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.
12
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.
17
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
21  *
22  * Author:
23  *      Maciej Piechotka <uzytkownik2@gmail.com>
24  */
25
26 #include <glib.h>
27 #include <glib-object.h>
28 #include <gobject/gvaluecollector.h>
29
30
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))
35
36 typedef struct _GeeTraversable GeeTraversable;
37 typedef struct _GeeTraversableIface GeeTraversableIface;
38
39 #define GEE_TRAVERSABLE_TYPE_STREAM (gee_traversable_stream_get_type ())
40
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))
47
48 typedef struct _GeeLazy GeeLazy;
49 typedef struct _GeeLazyClass GeeLazyClass;
50
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))
55
56 typedef struct _GeeIterator GeeIterator;
57 typedef struct _GeeIteratorIface GeeIteratorIface;
58
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))
63
64 typedef struct _GeeIterable GeeIterable;
65 typedef struct _GeeIterableIface GeeIterableIface;
66
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))
71
72 typedef struct _GeeCollection GeeCollection;
73 typedef struct _GeeCollectionIface GeeCollectionIface;
74
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))
81
82 typedef struct _GeeAbstractCollection GeeAbstractCollection;
83 typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass;
84 typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate;
85
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))
90
91 typedef struct _GeeList GeeList;
92 typedef struct _GeeListIface GeeListIface;
93
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))
98
99 typedef struct _GeeListIterator GeeListIterator;
100 typedef struct _GeeListIteratorIface GeeListIteratorIface;
101
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))
108
109 typedef struct _GeeAbstractList GeeAbstractList;
110 typedef struct _GeeAbstractListClass GeeAbstractListClass;
111 typedef struct _GeeAbstractListPrivate GeeAbstractListPrivate;
112
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))
119
120 typedef struct _GeeConcurrentList GeeConcurrentList;
121 typedef struct _GeeConcurrentListClass GeeConcurrentListClass;
122 typedef struct _GeeConcurrentListPrivate GeeConcurrentListPrivate;
123
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))
130
131 typedef struct _GeeConcurrentListNode GeeConcurrentListNode;
132 typedef struct _GeeConcurrentListNodeClass GeeConcurrentListNodeClass;
133
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)))
138
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)))
141
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))
148
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);
156
157 typedef gboolean (*GeeForallFunc) (gpointer g, void* user_data);
158 typedef enum  {
159         GEE_TRAVERSABLE_STREAM_YIELD,
160         GEE_TRAVERSABLE_STREAM_CONTINUE,
161         GEE_TRAVERSABLE_STREAM_END
162 } GeeTraversableStream;
163
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);
173 };
174
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);
191 };
192
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);
199 };
200
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);
219 };
220
221 struct _GeeAbstractCollection {
222         GObject parent_instance;
223         GeeAbstractCollectionPrivate * priv;
224 };
225
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);
247 };
248
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);
254 };
255
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);
273 };
274
275 struct _GeeAbstractList {
276         GeeAbstractCollection parent_instance;
277         GeeAbstractListPrivate * priv;
278 };
279
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);
300 };
301
302 struct _GeeConcurrentList {
303         GeeAbstractList parent_instance;
304         GeeConcurrentListPrivate * priv;
305 };
306
307 struct _GeeConcurrentListClass {
308         GeeAbstractListClass parent_class;
309 };
310
311 typedef gboolean (*GeeEqualDataFunc) (gconstpointer a, gconstpointer b, void* user_data);
312 struct _GeeConcurrentListPrivate {
313         GType g_type;
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;
321 };
322
323 typedef enum  {
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;
331
332 typedef enum  {
333         GEE_CONCURRENT_LIST_STATE_NONE = 0,
334         GEE_CONCURRENT_LIST_STATE_MARKED = 1,
335         GEE_CONCURRENT_LIST_STATE_FLAGGED = 2
336 } GeeConcurrentListState;
337
338 struct _GeeConcurrentListIterator {
339         GObject parent_instance;
340         GeeConcurrentListIteratorPrivate * priv;
341 };
342
343 struct _GeeConcurrentListIteratorClass {
344         GObjectClass parent_class;
345 };
346
347 struct _GeeConcurrentListIteratorPrivate {
348         GType g_type;
349         GBoxedCopyFunc g_dup_func;
350         GDestroyNotify g_destroy_func;
351         gboolean _removed;
352         gint _index;
353         GeeConcurrentListNode* _prev;
354         GeeConcurrentListNode* _curr;
355 };
356
357 struct _GeeConcurrentListNode {
358         GTypeInstance parent_instance;
359         volatile int ref_count;
360         GeeConcurrentListNodePrivate * priv;
361         GeeConcurrentListNode* _succ;
362         GeeConcurrentListNode* _backlink;
363         gconstpointer* _data;
364 };
365
366 struct _GeeConcurrentListNodeClass {
367         GTypeClass parent_class;
368         void (*finalize) (GeeConcurrentListNode *self);
369 };
370
371 struct _GeeConcurrentListNodePrivate {
372         GType g_type;
373         GBoxedCopyFunc g_dup_func;
374         GDestroyNotify g_destroy_func;
375 };
376
377 struct _GeeConcurrentListParamSpecNode {
378         GParamSpec parent_instance;
379 };
380
381
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;
388
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))
414 enum  {
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
422 };
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))
471 enum  {
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
478 };
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))
495 enum  {
496         GEE_CONCURRENT_LIST_NODE_DUMMY_PROPERTY
497 };
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);
516
517
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);
525         }
526         return gee_concurrent_list_state_type_id__volatile;
527 }
528
529
530 /**
531  * Construct new, empty single linked list
532  *
533  * If not provided, the function parameter is requested to the
534  * {@link Functions} function factory methods.
535  *
536  * @param equal_func an optional element equality testing function
537  */
538 static gpointer _gee_concurrent_list_node_ref0 (gpointer self) {
539         return self ? gee_concurrent_list_node_ref (self) : NULL;
540 }
541
542
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_;
546         void* _tmp0__target;
547         GeeEqualDataFunc _tmp4_;
548         void* _tmp4__target;
549         GDestroyNotify _tmp4__target_destroy_notify;
550         GeeEqualDataFunc _tmp5_;
551         void* _tmp5__target;
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;
560         _tmp0_ = equal_func;
561         _tmp0__target = equal_func_target;
562         if (_tmp0_ == NULL) {
563                 void* _tmp1_ = 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);
568                 equal_func = NULL;
569                 equal_func_target = NULL;
570                 equal_func_target_destroy_notify = NULL;
571                 equal_func = _tmp3_;
572                 equal_func_target = _tmp1_;
573                 equal_func_target_destroy_notify = _tmp2_;
574         }
575         _tmp4_ = equal_func;
576         _tmp4__target = equal_func_target;
577         _tmp4__target_destroy_notify = equal_func_target_destroy_notify;
578         equal_func_target_destroy_notify = NULL;
579         _tmp5_ = _tmp4_;
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);
584         _tmp5_ = 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);
594         equal_func = NULL;
595         equal_func_target = NULL;
596         equal_func_target_destroy_notify = NULL;
597         return self;
598 }
599
600
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);
603 }
604
605
606 /**
607  * {@inheritDoc}
608  */
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);
616         ctx = _tmp0_;
617         {
618                 GeeIterator* _tmp1_ = NULL;
619                 GeeIterator* iter;
620                 _tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
621                 iter = _tmp1_;
622                 {
623                         gboolean _tmp2_;
624                         _tmp2_ = TRUE;
625                         while (TRUE) {
626                                 gboolean _tmp3_;
627                                 GeeIterator* _tmp4_;
628                                 gboolean _tmp5_ = FALSE;
629                                 GeeEqualDataFunc _tmp6_;
630                                 void* _tmp6__target;
631                                 GeeEqualDataFunc _tmp7_;
632                                 void* _tmp7__target;
633                                 gconstpointer _tmp8_;
634                                 GeeIterator* _tmp9_;
635                                 gpointer _tmp10_ = NULL;
636                                 gpointer _tmp11_;
637                                 gboolean _tmp12_ = FALSE;
638                                 gboolean _tmp13_;
639                                 _tmp3_ = _tmp2_;
640                                 if (!_tmp3_) {
641                                 }
642                                 _tmp2_ = FALSE;
643                                 _tmp4_ = iter;
644                                 _tmp5_ = gee_iterator_next (_tmp4_);
645                                 if (!_tmp5_) {
646                                         break;
647                                 }
648                                 _tmp6_ = gee_concurrent_list_get_equal_func (self, &_tmp6__target);
649                                 _tmp7_ = _tmp6_;
650                                 _tmp7__target = _tmp6__target;
651                                 _tmp8_ = item;
652                                 _tmp9_ = iter;
653                                 _tmp10_ = gee_iterator_get (_tmp9_);
654                                 _tmp11_ = _tmp10_;
655                                 _tmp12_ = _tmp7_ (_tmp8_, _tmp11_, _tmp7__target);
656                                 _tmp13_ = _tmp12_;
657                                 ((_tmp11_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp11_ = (self->priv->g_destroy_func (_tmp11_), NULL));
658                                 if (_tmp13_) {
659                                         result = TRUE;
660                                         _g_object_unref0 (iter);
661                                         _gee_hazard_pointer_context_free0 (ctx);
662                                         return result;
663                                 }
664                         }
665                 }
666                 _g_object_unref0 (iter);
667         }
668         result = FALSE;
669         _gee_hazard_pointer_context_free0 (ctx);
670         return result;
671 }
672
673
674 /**
675  * {@inheritDoc}
676  */
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);
688         ctx = _tmp0_;
689         _tmp1_ = item;
690         _tmp2_ = gee_concurrent_list_node_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp1_);
691         node = _tmp2_;
692         _tmp3_ = gee_concurrent_list_get_tail (self);
693         gee_concurrent_list_node_insert (node, _tmp3_, NULL);
694         result = TRUE;
695         _gee_concurrent_list_node_unref0 (node);
696         _gee_hazard_pointer_context_free0 (ctx);
697         return result;
698 }
699
700
701 /**
702  * {@inheritDoc}
703  */
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;
710         GeeIterator* iter;
711         self = (GeeConcurrentList*) base;
712         _tmp0_ = gee_hazard_pointer_context_new (NULL);
713         ctx = _tmp0_;
714         _tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
715         iter = _tmp1_;
716         while (TRUE) {
717                 GeeIterator* _tmp2_;
718                 gboolean _tmp3_ = FALSE;
719                 GeeEqualDataFunc _tmp4_;
720                 void* _tmp4__target;
721                 GeeEqualDataFunc _tmp5_;
722                 void* _tmp5__target;
723                 gconstpointer _tmp6_;
724                 GeeIterator* _tmp7_;
725                 gpointer _tmp8_ = NULL;
726                 gpointer _tmp9_;
727                 gboolean _tmp10_ = FALSE;
728                 gboolean _tmp11_;
729                 _tmp2_ = iter;
730                 _tmp3_ = gee_iterator_next (_tmp2_);
731                 if (!_tmp3_) {
732                         break;
733                 }
734                 _tmp4_ = gee_concurrent_list_get_equal_func (self, &_tmp4__target);
735                 _tmp5_ = _tmp4_;
736                 _tmp5__target = _tmp4__target;
737                 _tmp6_ = item;
738                 _tmp7_ = iter;
739                 _tmp8_ = gee_iterator_get (_tmp7_);
740                 _tmp9_ = _tmp8_;
741                 _tmp10_ = _tmp5_ (_tmp6_, _tmp9_, _tmp5__target);
742                 _tmp11_ = _tmp10_;
743                 ((_tmp9_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp9_ = (self->priv->g_destroy_func (_tmp9_), NULL));
744                 if (_tmp11_) {
745                         GeeIterator* _tmp12_;
746                         _tmp12_ = iter;
747                         gee_iterator_remove (_tmp12_);
748                         result = TRUE;
749                         _g_object_unref0 (iter);
750                         _gee_hazard_pointer_context_free0 (ctx);
751                         return result;
752                 }
753         }
754         result = FALSE;
755         _g_object_unref0 (iter);
756         _gee_hazard_pointer_context_free0 (ctx);
757         return result;
758 }
759
760
761 /**
762  * {@inheritDoc}
763  */
764 static void gee_concurrent_list_real_clear (GeeAbstractCollection* base) {
765         GeeConcurrentList * self;
766         GeeHazardPointerContext* _tmp0_;
767         GeeHazardPointerContext* ctx;
768         GeeIterator* _tmp1_ = NULL;
769         GeeIterator* iter;
770         GeeConcurrentListNode* _tmp5_;
771         GeeConcurrentListNode* _tmp6_;
772         self = (GeeConcurrentList*) base;
773         _tmp0_ = gee_hazard_pointer_context_new (NULL);
774         ctx = _tmp0_;
775         _tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
776         iter = _tmp1_;
777         while (TRUE) {
778                 GeeIterator* _tmp2_;
779                 gboolean _tmp3_ = FALSE;
780                 GeeIterator* _tmp4_;
781                 _tmp2_ = iter;
782                 _tmp3_ = gee_iterator_next (_tmp2_);
783                 if (!_tmp3_) {
784                         break;
785                 }
786                 _tmp4_ = iter;
787                 gee_iterator_remove (_tmp4_);
788         }
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);
794 }
795
796
797 /**
798  * {@inheritDoc}
799  */
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_;
809         return result;
810 }
811
812
813 /**
814  * {@inheritDoc}
815  */
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_;
825         return result;
826 }
827
828
829 /**
830  * {@inheritDoc}
831  */
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;
837         gint _tmp1_;
838         self = (GeeConcurrentList*) base;
839         _tmp0_ = gee_hazard_pointer_context_new (NULL);
840         ctx = _tmp0_;
841         _tmp1_ = index;
842         _vala_assert (_tmp1_ >= 0, "index >= 0");
843         {
844                 GeeIterator* _tmp2_ = NULL;
845                 GeeIterator* iterator;
846                 _tmp2_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
847                 iterator = _tmp2_;
848                 {
849                         gboolean _tmp3_;
850                         _tmp3_ = TRUE;
851                         while (TRUE) {
852                                 gboolean _tmp4_;
853                                 GeeIterator* _tmp5_;
854                                 gboolean _tmp6_ = FALSE;
855                                 gint _tmp7_;
856                                 _tmp4_ = _tmp3_;
857                                 if (!_tmp4_) {
858                                 }
859                                 _tmp3_ = FALSE;
860                                 _tmp5_ = iterator;
861                                 _tmp6_ = gee_iterator_next (_tmp5_);
862                                 if (!_tmp6_) {
863                                         break;
864                                 }
865                                 _tmp7_ = index;
866                                 index = _tmp7_ - 1;
867                                 if (_tmp7_ == 0) {
868                                         GeeIterator* _tmp8_;
869                                         gpointer _tmp9_ = NULL;
870                                         _tmp8_ = iterator;
871                                         _tmp9_ = gee_iterator_get (_tmp8_);
872                                         result = _tmp9_;
873                                         _g_object_unref0 (iterator);
874                                         _gee_hazard_pointer_context_free0 (ctx);
875                                         return result;
876                                 }
877                         }
878                 }
879                 _g_object_unref0 (iterator);
880         }
881         g_assert_not_reached ();
882         _gee_hazard_pointer_context_free0 (ctx);
883 }
884
885
886 /**
887  * {@inheritDoc}
888  */
889 static void gee_concurrent_list_real_set (GeeAbstractList* base, gint index, gconstpointer item) {
890         GeeConcurrentList * self;
891         GeeHazardPointerContext* _tmp0_;
892         GeeHazardPointerContext* ctx;
893         gint _tmp1_;
894         self = (GeeConcurrentList*) base;
895         _tmp0_ = gee_hazard_pointer_context_new (NULL);
896         ctx = _tmp0_;
897         _tmp1_ = index;
898         _vala_assert (_tmp1_ >= 0, "index >= 0");
899         {
900                 GeeListIterator* _tmp2_ = NULL;
901                 GeeListIterator* iterator;
902                 _tmp2_ = gee_abstract_list_list_iterator ((GeeAbstractList*) self);
903                 iterator = _tmp2_;
904                 {
905                         gboolean _tmp3_;
906                         _tmp3_ = TRUE;
907                         while (TRUE) {
908                                 gboolean _tmp4_;
909                                 GeeListIterator* _tmp5_;
910                                 gboolean _tmp6_ = FALSE;
911                                 gint _tmp7_;
912                                 _tmp4_ = _tmp3_;
913                                 if (!_tmp4_) {
914                                 }
915                                 _tmp3_ = FALSE;
916                                 _tmp5_ = iterator;
917                                 _tmp6_ = gee_iterator_next ((GeeIterator*) _tmp5_);
918                                 if (!_tmp6_) {
919                                         break;
920                                 }
921                                 _tmp7_ = index;
922                                 index = _tmp7_ - 1;
923                                 if (_tmp7_ == 0) {
924                                         GeeListIterator* _tmp8_;
925                                         gconstpointer _tmp9_;
926                                         _tmp8_ = iterator;
927                                         _tmp9_ = item;
928                                         gee_list_iterator_set (_tmp8_, _tmp9_);
929                                         _g_object_unref0 (iterator);
930                                         _gee_hazard_pointer_context_free0 (ctx);
931                                         return;
932                                 }
933                         }
934                 }
935                 _g_object_unref0 (iterator);
936         }
937         g_assert_not_reached ();
938         _gee_hazard_pointer_context_free0 (ctx);
939 }
940
941
942 /**
943  * {@inheritDoc}
944  */
945 static gint gee_concurrent_list_real_index_of (GeeAbstractList* base, gconstpointer item) {
946         GeeConcurrentList * self;
947         gint result = 0;
948         GeeHazardPointerContext* _tmp0_;
949         GeeHazardPointerContext* ctx;
950         gint index;
951         self = (GeeConcurrentList*) base;
952         _tmp0_ = gee_hazard_pointer_context_new (NULL);
953         ctx = _tmp0_;
954         index = 0;
955         {
956                 GeeListIterator* _tmp1_ = NULL;
957                 GeeListIterator* iterator;
958                 _tmp1_ = gee_abstract_list_list_iterator ((GeeAbstractList*) self);
959                 iterator = _tmp1_;
960                 {
961                         gboolean _tmp2_;
962                         _tmp2_ = TRUE;
963                         while (TRUE) {
964                                 gboolean _tmp3_;
965                                 GeeListIterator* _tmp5_;
966                                 gboolean _tmp6_ = FALSE;
967                                 GeeEqualDataFunc _tmp7_;
968                                 void* _tmp7__target;
969                                 GeeEqualDataFunc _tmp8_;
970                                 void* _tmp8__target;
971                                 gconstpointer _tmp9_;
972                                 GeeListIterator* _tmp10_;
973                                 gpointer _tmp11_ = NULL;
974                                 gpointer _tmp12_;
975                                 gboolean _tmp13_ = FALSE;
976                                 gboolean _tmp14_;
977                                 _tmp3_ = _tmp2_;
978                                 if (!_tmp3_) {
979                                         gint _tmp4_;
980                                         _tmp4_ = index;
981                                         index = _tmp4_ + 1;
982                                 }
983                                 _tmp2_ = FALSE;
984                                 _tmp5_ = iterator;
985                                 _tmp6_ = gee_iterator_next ((GeeIterator*) _tmp5_);
986                                 if (!_tmp6_) {
987                                         break;
988                                 }
989                                 _tmp7_ = gee_concurrent_list_get_equal_func (self, &_tmp7__target);
990                                 _tmp8_ = _tmp7_;
991                                 _tmp8__target = _tmp7__target;
992                                 _tmp9_ = item;
993                                 _tmp10_ = iterator;
994                                 _tmp11_ = gee_iterator_get ((GeeIterator*) _tmp10_);
995                                 _tmp12_ = _tmp11_;
996                                 _tmp13_ = _tmp8_ (_tmp9_, _tmp12_, _tmp8__target);
997                                 _tmp14_ = _tmp13_;
998                                 ((_tmp12_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp12_ = (self->priv->g_destroy_func (_tmp12_), NULL));
999                                 if (_tmp14_) {
1000                                         result = index;
1001                                         _g_object_unref0 (iterator);
1002                                         _gee_hazard_pointer_context_free0 (ctx);
1003                                         return result;
1004                                 }
1005                         }
1006                 }
1007                 _g_object_unref0 (iterator);
1008         }
1009         result = -1;
1010         _gee_hazard_pointer_context_free0 (ctx);
1011         return result;
1012 }
1013
1014
1015 /**
1016  * {@inheritDoc}
1017  */
1018 static void gee_concurrent_list_real_insert (GeeAbstractList* base, gint index, gconstpointer item) {
1019         GeeConcurrentList * self;
1020         GeeHazardPointerContext* _tmp0_;
1021         GeeHazardPointerContext* ctx;
1022         gint _tmp1_;
1023         gint _tmp2_;
1024         self = (GeeConcurrentList*) base;
1025         _tmp0_ = gee_hazard_pointer_context_new (NULL);
1026         ctx = _tmp0_;
1027         _tmp1_ = index;
1028         _vala_assert (_tmp1_ >= 0, "index >= 0");
1029         _tmp2_ = index;
1030         if (_tmp2_ == 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_);
1046                 prev = _tmp4_;
1047                 _tmp5_ = self->priv->_head;
1048                 _tmp6_ = gee_concurrent_list_node_get_next (_tmp5_);
1049                 next = _tmp6_;
1050                 _tmp7_ = item;
1051                 _tmp8_ = gee_concurrent_list_node_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp7_);
1052                 new_node = _tmp8_;
1053                 _tmp9_ = new_node;
1054                 _tmp10_ = prev;
1055                 _tmp11_ = _gee_concurrent_list_node_ref0 (_tmp10_);
1056                 _tmp12_ = next;
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);
1061         } else {
1062                 {
1063                         GeeListIterator* _tmp13_ = NULL;
1064                         GeeListIterator* iterator;
1065                         _tmp13_ = gee_abstract_list_list_iterator ((GeeAbstractList*) self);
1066                         iterator = _tmp13_;
1067                         {
1068                                 gboolean _tmp14_;
1069                                 _tmp14_ = TRUE;
1070                                 while (TRUE) {
1071                                         gboolean _tmp15_;
1072                                         GeeListIterator* _tmp16_;
1073                                         gboolean _tmp17_ = FALSE;
1074                                         gint _tmp18_;
1075                                         gint _tmp19_;
1076                                         _tmp15_ = _tmp14_;
1077                                         if (!_tmp15_) {
1078                                         }
1079                                         _tmp14_ = FALSE;
1080                                         _tmp16_ = iterator;
1081                                         _tmp17_ = gee_iterator_next ((GeeIterator*) _tmp16_);
1082                                         if (!_tmp17_) {
1083                                                 break;
1084                                         }
1085                                         _tmp18_ = index;
1086                                         index = _tmp18_ - 1;
1087                                         _tmp19_ = index;
1088                                         if (_tmp19_ == 0) {
1089                                                 GeeListIterator* _tmp20_;
1090                                                 gconstpointer _tmp21_;
1091                                                 _tmp20_ = iterator;
1092                                                 _tmp21_ = item;
1093                                                 gee_list_iterator_add (_tmp20_, _tmp21_);
1094                                                 _g_object_unref0 (iterator);
1095                                                 _gee_hazard_pointer_context_free0 (ctx);
1096                                                 return;
1097                                         }
1098                                 }
1099                         }
1100                         _g_object_unref0 (iterator);
1101                 }
1102                 g_assert_not_reached ();
1103         }
1104         _gee_hazard_pointer_context_free0 (ctx);
1105 }
1106
1107
1108 /**
1109  * {@inheritDoc}
1110  */
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);
1118         ctx = _tmp0_;
1119         {
1120                 GeeListIterator* _tmp1_ = NULL;
1121                 GeeListIterator* iterator;
1122                 _tmp1_ = gee_abstract_list_list_iterator ((GeeAbstractList*) self);
1123                 iterator = _tmp1_;
1124                 {
1125                         gboolean _tmp2_;
1126                         _tmp2_ = TRUE;
1127                         while (TRUE) {
1128                                 gboolean _tmp3_;
1129                                 GeeListIterator* _tmp4_;
1130                                 gboolean _tmp5_ = FALSE;
1131                                 gint _tmp6_;
1132                                 _tmp3_ = _tmp2_;
1133                                 if (!_tmp3_) {
1134                                 }
1135                                 _tmp2_ = FALSE;
1136                                 _tmp4_ = iterator;
1137                                 _tmp5_ = gee_iterator_next ((GeeIterator*) _tmp4_);
1138                                 if (!_tmp5_) {
1139                                         break;
1140                                 }
1141                                 _tmp6_ = index;
1142                                 index = _tmp6_ - 1;
1143                                 if (_tmp6_ == 0) {
1144                                         GeeListIterator* _tmp7_;
1145                                         gpointer _tmp8_ = NULL;
1146                                         gpointer data;
1147                                         GeeListIterator* _tmp9_;
1148                                         _tmp7_ = iterator;
1149                                         _tmp8_ = gee_iterator_get ((GeeIterator*) _tmp7_);
1150                                         data = _tmp8_;
1151                                         _tmp9_ = iterator;
1152                                         gee_iterator_remove ((GeeIterator*) _tmp9_);
1153                                         result = data;
1154                                         _g_object_unref0 (iterator);
1155                                         _gee_hazard_pointer_context_free0 (ctx);
1156                                         return result;
1157                                 }
1158                         }
1159                 }
1160                 _g_object_unref0 (iterator);
1161         }
1162         g_assert_not_reached ();
1163         _gee_hazard_pointer_context_free0 (ctx);
1164 }
1165
1166
1167 /**
1168  * {@inheritDoc}
1169  */
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;
1175         gint _tmp1_;
1176         gint _tmp2_;
1177         gint _tmp3_;
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;
1186         gint idx;
1187         gint _tmp25_;
1188         gint _tmp26_;
1189         self = (GeeConcurrentList*) base;
1190         _tmp0_ = gee_hazard_pointer_context_new (NULL);
1191         ctx = _tmp0_;
1192         _tmp1_ = start;
1193         _vala_assert (0 <= _tmp1_, "0 <= start");
1194         _tmp2_ = start;
1195         _tmp3_ = end;
1196         _vala_assert (_tmp2_ <= _tmp3_, "start <= end");
1197         _tmp4_ = gee_concurrent_list_get_equal_func (self, &_tmp4__target);
1198         _tmp5_ = _tmp4_;
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);
1201         list = _tmp6_;
1202         _tmp7_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
1203         iterator = _tmp7_;
1204         idx = 0;
1205         {
1206                 gboolean _tmp8_;
1207                 _tmp8_ = TRUE;
1208                 while (TRUE) {
1209                         gboolean _tmp9_;
1210                         GeeIterator* _tmp11_;
1211                         gboolean _tmp12_ = FALSE;
1212                         gboolean _tmp13_ = FALSE;
1213                         gint _tmp14_;
1214                         gint _tmp15_;
1215                         gboolean _tmp18_;
1216                         _tmp9_ = _tmp8_;
1217                         if (!_tmp9_) {
1218                                 gint _tmp10_;
1219                                 _tmp10_ = idx;
1220                                 idx = _tmp10_ + 1;
1221                         }
1222                         _tmp8_ = FALSE;
1223                         _tmp11_ = iterator;
1224                         _tmp12_ = gee_iterator_next (_tmp11_);
1225                         if (!_tmp12_) {
1226                                 break;
1227                         }
1228                         _tmp14_ = idx;
1229                         _tmp15_ = start;
1230                         if (_tmp14_ >= _tmp15_) {
1231                                 gint _tmp16_;
1232                                 gint _tmp17_;
1233                                 _tmp16_ = idx;
1234                                 _tmp17_ = end;
1235                                 _tmp13_ = _tmp16_ < _tmp17_;
1236                         } else {
1237                                 _tmp13_ = FALSE;
1238                         }
1239                         _tmp18_ = _tmp13_;
1240                         if (_tmp18_) {
1241                                 GeeConcurrentList* _tmp19_;
1242                                 GeeIterator* _tmp20_;
1243                                 gpointer _tmp21_ = NULL;
1244                                 gpointer _tmp22_;
1245                                 _tmp19_ = list;
1246                                 _tmp20_ = iterator;
1247                                 _tmp21_ = gee_iterator_get (_tmp20_);
1248                                 _tmp22_ = _tmp21_;
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));
1251                         } else {
1252                                 gint _tmp23_;
1253                                 gint _tmp24_;
1254                                 _tmp23_ = idx;
1255                                 _tmp24_ = end;
1256                                 if (_tmp23_ >= _tmp24_) {
1257                                         break;
1258                                 }
1259                         }
1260                 }
1261         }
1262         _tmp25_ = idx;
1263         _tmp26_ = end;
1264         _vala_assert (_tmp25_ >= _tmp26_, "idx >= end");
1265         result = (GeeList*) list;
1266         _g_object_unref0 (iterator);
1267         _gee_hazard_pointer_context_free0 (ctx);
1268         return result;
1269 }
1270
1271
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);
1283         _tmp1_ = 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);
1286         result = tail;
1287         return result;
1288 }
1289
1290
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);
1296         result = _tmp0_;
1297         return result;
1298 }
1299
1300
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;
1310         _tmp1_ = _tmp0_;
1311         _tmp1__target = _tmp0__target;
1312         *result_target = _tmp1__target;
1313         result = _tmp1_;
1314         return result;
1315 }
1316
1317
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);
1322         _tmp0_ = value;
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;
1331 }
1332
1333
1334 static gboolean gee_concurrent_list_real_get_read_only (GeeAbstractCollection* base) {
1335         gboolean result;
1336         GeeConcurrentList* self;
1337         self = (GeeConcurrentList*) base;
1338         result = FALSE;
1339         return result;
1340 }
1341
1342
1343 static gint gee_concurrent_list_real_get_size (GeeAbstractCollection* base) {
1344         gint result;
1345         GeeConcurrentList* self;
1346         GeeHazardPointerContext* _tmp0_;
1347         GeeHazardPointerContext* ctx;
1348         gint _result_;
1349         gint _tmp7_;
1350         self = (GeeConcurrentList*) base;
1351         _tmp0_ = gee_hazard_pointer_context_new (NULL);
1352         ctx = _tmp0_;
1353         _result_ = 0;
1354         {
1355                 GeeIterator* _tmp1_ = NULL;
1356                 GeeIterator* iter;
1357                 _tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
1358                 iter = _tmp1_;
1359                 {
1360                         gboolean _tmp2_;
1361                         _tmp2_ = TRUE;
1362                         while (TRUE) {
1363                                 gboolean _tmp3_;
1364                                 GeeIterator* _tmp4_;
1365                                 gboolean _tmp5_ = FALSE;
1366                                 gint _tmp6_;
1367                                 _tmp3_ = _tmp2_;
1368                                 if (!_tmp3_) {
1369                                 }
1370                                 _tmp2_ = FALSE;
1371                                 _tmp4_ = iter;
1372                                 _tmp5_ = gee_iterator_next (_tmp4_);
1373                                 if (!_tmp5_) {
1374                                         break;
1375                                 }
1376                                 _tmp6_ = _result_;
1377                                 _result_ = _tmp6_ + 1;
1378                         }
1379                 }
1380                 _g_object_unref0 (iter);
1381         }
1382         _tmp7_ = _result_;
1383         result = _tmp7_;
1384         _gee_hazard_pointer_context_free0 (ctx);
1385         return result;
1386 }
1387
1388
1389 gboolean gee_concurrent_list_get_is_empty (GeeConcurrentList* self) {
1390         gboolean result;
1391         GeeIterator* _tmp0_ = NULL;
1392         GeeIterator* _tmp1_;
1393         gboolean _tmp2_ = FALSE;
1394         gboolean _tmp3_;
1395         g_return_val_if_fail (self != NULL, FALSE);
1396         _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self);
1397         _tmp1_ = _tmp0_;
1398         _tmp2_ = gee_iterator_next (_tmp1_);
1399         _tmp3_ = !_tmp2_;
1400         _g_object_unref0 (_tmp1_);
1401         result = _tmp3_;
1402         return result;
1403 }
1404
1405
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;
1419         _tmp0_ = head;
1420         _tmp1_ = _gee_concurrent_list_node_ref0 (_tmp0_);
1421         _gee_concurrent_list_node_unref0 (self->priv->_curr);
1422         self->priv->_curr = _tmp1_;
1423         return self;
1424 }
1425
1426
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);
1429 }
1430
1431
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;
1438         gboolean _tmp2_;
1439         GeeConcurrentListNode* _tmp4_;
1440         GeeConcurrentListNode* _tmp5_;
1441         GeeConcurrentListNode* _old_prev;
1442         gboolean _tmp6_ = FALSE;
1443         gboolean success;
1444         gboolean _tmp7_;
1445         self = (GeeConcurrentListIterator*) base;
1446         _tmp0_ = gee_hazard_pointer_context_new (NULL);
1447         ctx = _tmp0_;
1448         _tmp2_ = self->priv->_removed;
1449         if (_tmp2_) {
1450                 GeeConcurrentListNode* _tmp3_;
1451                 _tmp3_ = self->priv->_prev;
1452                 _tmp1_ = _tmp3_;
1453         } else {
1454                 _tmp1_ = NULL;
1455         }
1456         _tmp4_ = _tmp1_;
1457         _tmp5_ = _gee_concurrent_list_node_ref0 (_tmp4_);
1458         _old_prev = _tmp5_;
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);
1460         success = _tmp6_;
1461         _tmp7_ = success;
1462         if (_tmp7_) {
1463                 gboolean _tmp8_;
1464                 gint _tmp10_;
1465                 _tmp8_ = self->priv->_removed;
1466                 if (_tmp8_) {
1467                         GeeConcurrentListNode* _tmp9_;
1468                         _tmp9_ = _old_prev;
1469                         _old_prev = NULL;
1470                         _gee_concurrent_list_node_unref0 (self->priv->_prev);
1471                         self->priv->_prev = _tmp9_;
1472                 }
1473                 self->priv->_removed = FALSE;
1474                 _tmp10_ = self->priv->_index;
1475                 self->priv->_index = _tmp10_ + 1;
1476         }
1477         result = success;
1478         _gee_concurrent_list_node_unref0 (_old_prev);
1479         _gee_hazard_pointer_context_free0 (ctx);
1480         return result;
1481 }
1482
1483
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);
1498         ctx = _tmp0_;
1499         _tmp1_ = self->priv->_prev;
1500         _tmp2_ = _gee_concurrent_list_node_ref0 (_tmp1_);
1501         prev = _tmp2_;
1502         _tmp3_ = self->priv->_curr;
1503         _tmp4_ = _gee_concurrent_list_node_ref0 (_tmp3_);
1504         curr = _tmp4_;
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);
1506         result = _tmp5_;
1507         _gee_concurrent_list_node_unref0 (curr);
1508         _gee_concurrent_list_node_unref0 (prev);
1509         _gee_hazard_pointer_context_free0 (ctx);
1510         return result;
1511 }
1512
1513
1514 static gpointer gee_concurrent_list_iterator_real_get (GeeIterator* base) {
1515         GeeConcurrentListIterator * self;
1516         gpointer result = NULL;
1517         GeeHazardPointerContext* _tmp0_;
1518         GeeHazardPointerContext* ctx;
1519         gboolean _tmp1_;
1520         gboolean _tmp2_;
1521         GeeConcurrentListNode* _tmp3_;
1522         gpointer _tmp4_ = NULL;
1523         self = (GeeConcurrentListIterator*) base;
1524         _tmp0_ = gee_hazard_pointer_context_new (NULL);
1525         ctx = _tmp0_;
1526         _tmp1_ = gee_iterator_get_valid ((GeeIterator*) self);
1527         _tmp2_ = _tmp1_;
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);
1531         result = _tmp4_;
1532         _gee_hazard_pointer_context_free0 (ctx);
1533         return result;
1534 }
1535
1536
1537 static void gee_concurrent_list_iterator_real_set (GeeListIterator* base, gconstpointer item) {
1538         GeeConcurrentListIterator * self;
1539         GeeHazardPointerContext* _tmp0_;
1540         GeeHazardPointerContext* ctx;
1541         gboolean _tmp1_;
1542         gboolean _tmp2_;
1543         GeeConcurrentListNode* _tmp3_;
1544         gconstpointer _tmp4_;
1545         gpointer _tmp5_;
1546         self = (GeeConcurrentListIterator*) base;
1547         _tmp0_ = gee_hazard_pointer_context_new (NULL);
1548         ctx = _tmp0_;
1549         _tmp1_ = gee_iterator_get_valid ((GeeIterator*) self);
1550         _tmp2_ = _tmp1_;
1551         _vala_assert (_tmp2_, "valid");
1552         _tmp3_ = self->priv->_curr;
1553         _tmp4_ = item;
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);
1557 }
1558
1559
1560 static void gee_concurrent_list_iterator_real_remove (GeeIterator* base) {
1561         GeeConcurrentListIterator * self;
1562         GeeHazardPointerContext* _tmp0_;
1563         GeeHazardPointerContext* ctx;
1564         gboolean _tmp1_;
1565         gboolean _tmp2_;
1566         GeeConcurrentListNode* _tmp3_;
1567         GeeConcurrentListNode* _tmp4_;
1568         gint _tmp5_;
1569         self = (GeeConcurrentListIterator*) base;
1570         _tmp0_ = gee_hazard_pointer_context_new (NULL);
1571         ctx = _tmp0_;
1572         _tmp1_ = gee_iterator_get_valid ((GeeIterator*) self);
1573         _tmp2_ = _tmp1_;
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);
1582 }
1583
1584
1585 static gint gee_concurrent_list_iterator_real_index (GeeListIterator* base) {
1586         GeeConcurrentListIterator * self;
1587         gint result = 0;
1588         gboolean _tmp0_;
1589         gboolean _tmp1_;
1590         gint _tmp2_;
1591         self = (GeeConcurrentListIterator*) base;
1592         _tmp0_ = gee_iterator_get_valid ((GeeIterator*) self);
1593         _tmp1_ = _tmp0_;
1594         _vala_assert (_tmp1_, "valid");
1595         _tmp2_ = self->priv->_index;
1596         result = _tmp2_;
1597         return result;
1598 }
1599
1600
1601 static void gee_concurrent_list_iterator_real_add (GeeListIterator* base, gconstpointer item) {
1602         GeeConcurrentListIterator * self;
1603         GeeHazardPointerContext* _tmp0_;
1604         GeeHazardPointerContext* ctx;
1605         gboolean _tmp1_;
1606         gboolean _tmp2_;
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_;
1616         gint _tmp12_;
1617         self = (GeeConcurrentListIterator*) base;
1618         _tmp0_ = gee_hazard_pointer_context_new (NULL);
1619         ctx = _tmp0_;
1620         _tmp1_ = gee_iterator_get_valid ((GeeIterator*) self);
1621         _tmp2_ = _tmp1_;
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);
1624         if (!_tmp3_) {
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;
1632         }
1633         _tmp5_ = item;
1634         _tmp6_ = gee_concurrent_list_node_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp5_);
1635         new_node = _tmp6_;
1636         _tmp7_ = new_node;
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_);
1641         _tmp11_ = new_node;
1642         new_node = NULL;
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);
1649 }
1650
1651
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_;
1659         gboolean _tmp4_;
1660         GeeConcurrentListNode* _tmp9_ = NULL;
1661         gboolean _tmp10_;
1662         GeeConcurrentListNode* _tmp12_;
1663         GeeConcurrentListNode* _tmp13_;
1664         GeeConcurrentListNode* _old_prev;
1665         self = (GeeConcurrentListIterator*) base;
1666         _tmp0_ = gee_hazard_pointer_context_new (NULL);
1667         ctx = _tmp0_;
1668         _tmp2_ = self->priv->_prev;
1669         if (_tmp2_ != NULL) {
1670                 gboolean _tmp3_;
1671                 _tmp3_ = self->priv->_removed;
1672                 _tmp1_ = !_tmp3_;
1673         } else {
1674                 _tmp1_ = FALSE;
1675         }
1676         _tmp4_ = _tmp1_;
1677         if (_tmp4_) {
1678                 GeeForallFunc _tmp5_;
1679                 void* _tmp5__target;
1680                 GeeConcurrentListNode* _tmp6_;
1681                 gpointer _tmp7_ = NULL;
1682                 gboolean _tmp8_ = FALSE;
1683                 _tmp5_ = f;
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);
1688                 if (!_tmp8_) {
1689                         result = FALSE;
1690                         _gee_hazard_pointer_context_free0 (ctx);
1691                         return result;
1692                 }
1693         }
1694         _tmp10_ = self->priv->_removed;
1695         if (_tmp10_) {
1696                 GeeConcurrentListNode* _tmp11_;
1697                 _tmp11_ = self->priv->_prev;
1698                 _tmp9_ = _tmp11_;
1699         } else {
1700                 _tmp9_ = NULL;
1701         }
1702         _tmp12_ = _tmp9_;
1703         _tmp13_ = _gee_concurrent_list_node_ref0 (_tmp12_);
1704         _old_prev = _tmp13_;
1705         while (TRUE) {
1706                 gboolean _tmp14_ = FALSE;
1707                 gboolean _tmp15_;
1708                 gint _tmp17_;
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);
1715                 if (!_tmp14_) {
1716                         break;
1717                 }
1718                 _tmp15_ = self->priv->_removed;
1719                 if (_tmp15_) {
1720                         GeeConcurrentListNode* _tmp16_;
1721                         _tmp16_ = _old_prev;
1722                         _old_prev = NULL;
1723                         _gee_concurrent_list_node_unref0 (self->priv->_prev);
1724                         self->priv->_prev = _tmp16_;
1725                 }
1726                 self->priv->_removed = FALSE;
1727                 _tmp17_ = self->priv->_index;
1728                 self->priv->_index = _tmp17_ + 1;
1729                 _tmp18_ = f;
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);
1734                 if (!_tmp21_) {
1735                         result = FALSE;
1736                         _gee_concurrent_list_node_unref0 (_old_prev);
1737                         _gee_hazard_pointer_context_free0 (ctx);
1738                         return result;
1739                 }
1740         }
1741         result = TRUE;
1742         _gee_concurrent_list_node_unref0 (_old_prev);
1743         _gee_hazard_pointer_context_free0 (ctx);
1744         return result;
1745 }
1746
1747
1748 static gboolean gee_concurrent_list_iterator_real_get_valid (GeeIterator* base) {
1749         gboolean result;
1750         GeeConcurrentListIterator* self;
1751         GeeConcurrentListNode* _tmp0_;
1752         gboolean _tmp1_ = FALSE;
1753         GeeConcurrentListNode* _tmp2_;
1754         gboolean _tmp4_;
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) {
1760                 gboolean _tmp3_;
1761                 _tmp3_ = self->priv->_removed;
1762                 _tmp1_ = !_tmp3_;
1763         } else {
1764                 _tmp1_ = FALSE;
1765         }
1766         _tmp4_ = _tmp1_;
1767         result = _tmp4_;
1768         return result;
1769 }
1770
1771
1772 static gboolean gee_concurrent_list_iterator_real_get_read_only (GeeIterator* base) {
1773         gboolean result;
1774         GeeConcurrentListIterator* self;
1775         self = (GeeConcurrentListIterator*) base;
1776         result = FALSE;
1777         return result;
1778 }
1779
1780
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));
1792 }
1793
1794
1795 static GType gee_concurrent_list_iterator_gee_traversable_get_g_type (GeeConcurrentListIterator* self) {
1796         return self->priv->g_type;
1797 }
1798
1799
1800 static GBoxedCopyFunc gee_concurrent_list_iterator_gee_traversable_get_g_dup_func (GeeConcurrentListIterator* self) {
1801         return self->priv->g_dup_func;
1802 }
1803
1804
1805 static GDestroyNotify gee_concurrent_list_iterator_gee_traversable_get_g_destroy_func (GeeConcurrentListIterator* self) {
1806         return self->priv->g_destroy_func;
1807 }
1808
1809
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;
1816 }
1817
1818
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;
1827 }
1828
1829
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;
1835 }
1836
1837
1838 static void gee_concurrent_list_iterator_instance_init (GeeConcurrentListIterator * self) {
1839         self->priv = GEE_CONCURRENT_LIST_ITERATOR_GET_PRIVATE (self);
1840 }
1841
1842
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);
1849 }
1850
1851
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);
1865         }
1866         return gee_concurrent_list_iterator_type_id__volatile;
1867 }
1868
1869
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));
1876                 break;
1877                 case GEE_CONCURRENT_LIST_ITERATOR_READ_ONLY:
1878                 g_value_set_boolean (value, gee_iterator_get_read_only ((GeeIterator*) self));
1879                 break;
1880                 default:
1881                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1882                 break;
1883         }
1884 }
1885
1886
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);
1893                 break;
1894                 case GEE_CONCURRENT_LIST_ITERATOR_G_DUP_FUNC:
1895                 self->priv->g_dup_func = g_value_get_pointer (value);
1896                 break;
1897                 case GEE_CONCURRENT_LIST_ITERATOR_G_DESTROY_FUNC:
1898                 self->priv->g_destroy_func = g_value_get_pointer (value);
1899                 break;
1900                 default:
1901                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1902                 break;
1903         }
1904 }
1905
1906
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_;
1910         gpointer _tmp1_;
1911         gpointer data_copy;
1912         gpointer _tmp2_;
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);
1921         _tmp0_ = data;
1922         _tmp1_ = ((_tmp0_ != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) _tmp0_) : ((gpointer) _tmp0_);
1923         data_copy = _tmp1_;
1924         _tmp2_ = data_copy;
1925         data_copy = NULL;
1926         data_ptr = _tmp2_;
1927         _tmp3_ = data_ptr;
1928         data_ptr = NULL;
1929         g_atomic_pointer_set ((volatile gpointer *) (&self->_data), _tmp3_);
1930         _g_destroy_func0 (data_copy);
1931         return self;
1932 }
1933
1934
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);
1937 }
1938
1939
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);
1949         return self;
1950 }
1951
1952
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);
1955 }
1956
1957
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_;
1964         gboolean success;
1965         gboolean _tmp23_ = FALSE;
1966         gboolean _tmp24_;
1967         gboolean _tmp26_;
1968         g_return_val_if_fail (*curr != NULL, FALSE);
1969         _tmp0_ = *curr;
1970         _tmp1_ = gee_concurrent_list_node_get_next (_tmp0_);
1971         next = _tmp1_;
1972         while (TRUE) {
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_;
1984                 gboolean _tmp15_;
1985                 GeeConcurrentListNode* _tmp16_;
1986                 GeeConcurrentListNode* _tmp17_;
1987                 GeeConcurrentListNode* _tmp20_;
1988                 GeeConcurrentListNode* _tmp21_;
1989                 _tmp2_ = next;
1990                 if (!(_tmp2_ != NULL)) {
1991                         break;
1992                 }
1993                 _tmp3_ = next;
1994                 _tmp4_ = gee_concurrent_list_node_get_state (_tmp3_);
1995                 next_state = _tmp4_;
1996                 _tmp5_ = *curr;
1997                 _tmp7_ = gee_concurrent_list_node_get_succ (_tmp5_, &_tmp6_);
1998                 curr_state = _tmp6_;
1999                 curr_next = _tmp7_;
2000                 _tmp9_ = next_state;
2001                 if (_tmp9_ != GEE_CONCURRENT_LIST_STATE_MARKED) {
2002                         _tmp8_ = TRUE;
2003                 } else {
2004                         gboolean _tmp10_ = FALSE;
2005                         GeeConcurrentListState _tmp11_;
2006                         gboolean _tmp14_;
2007                         _tmp11_ = curr_state;
2008                         if (_tmp11_ == GEE_CONCURRENT_LIST_STATE_MARKED) {
2009                                 GeeConcurrentListNode* _tmp12_;
2010                                 GeeConcurrentListNode* _tmp13_;
2011                                 _tmp12_ = curr_next;
2012                                 _tmp13_ = next;
2013                                 _tmp10_ = _tmp12_ == _tmp13_;
2014                         } else {
2015                                 _tmp10_ = FALSE;
2016                         }
2017                         _tmp14_ = _tmp10_;
2018                         _tmp8_ = _tmp14_;
2019                 }
2020                 _tmp15_ = _tmp8_;
2021                 if (_tmp15_) {
2022                         _gee_concurrent_list_node_unref0 (curr_next);
2023                         break;
2024                 }
2025                 _tmp16_ = curr_next;
2026                 _tmp17_ = next;
2027                 if (_tmp16_ == _tmp17_) {
2028                         GeeConcurrentListNode* _tmp18_;
2029                         GeeConcurrentListNode* _tmp19_;
2030                         _tmp18_ = next;
2031                         _tmp19_ = *curr;
2032                         gee_concurrent_list_node_help_marked (_tmp18_, _tmp19_);
2033                 }
2034                 _tmp20_ = curr_next;
2035                 _tmp21_ = _gee_concurrent_list_node_ref0 (_tmp20_);
2036                 _gee_concurrent_list_node_unref0 (next);
2037                 next = _tmp21_;
2038                 _gee_concurrent_list_node_unref0 (curr_next);
2039         }
2040         _tmp22_ = next;
2041         success = _tmp22_ != NULL;
2042         _tmp24_ = success;
2043         if (_tmp24_) {
2044                 _tmp23_ = TRUE;
2045         } else {
2046                 gboolean _tmp25_;
2047                 _tmp25_ = force;
2048                 _tmp23_ = _tmp25_;
2049         }
2050         _tmp26_ = _tmp23_;
2051         if (_tmp26_) {
2052                 GeeConcurrentListNode* _tmp27_;
2053                 GeeConcurrentListNode* _tmp28_;
2054                 _tmp27_ = *curr;
2055                 *curr = NULL;
2056                 _gee_concurrent_list_node_unref0 (*prev);
2057                 *prev = _tmp27_;
2058                 _tmp28_ = next;
2059                 next = NULL;
2060                 _gee_concurrent_list_node_unref0 (*curr);
2061                 *curr = _tmp28_;
2062         }
2063         result = success;
2064         _gee_concurrent_list_node_unref0 (next);
2065         return result;
2066 }
2067
2068
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_;
2076         _tmp0_ = *prev;
2077         _tmp1_ = gee_concurrent_list_node_get_next (_tmp0_);
2078         curr = _tmp1_;
2079         while (TRUE) {
2080                 gboolean _tmp2_ = FALSE;
2081                 gboolean _tmp3_ = FALSE;
2082                 GeeConcurrentListNode* _tmp4_;
2083                 GeeConcurrentListNode* _tmp5_;
2084                 gboolean _tmp7_;
2085                 gboolean _tmp9_;
2086                 _tmp4_ = curr;
2087                 _tmp5_ = goal;
2088                 if (_tmp4_ != _tmp5_) {
2089                         _tmp3_ = TRUE;
2090                 } else {
2091                         GeeConcurrentListNode* _tmp6_;
2092                         _tmp6_ = curr;
2093                         _tmp3_ = _tmp6_ != NULL;
2094                 }
2095                 _tmp7_ = _tmp3_;
2096                 if (_tmp7_) {
2097                         gboolean _tmp8_ = FALSE;
2098                         _tmp8_ = gee_concurrent_list_node_proceed (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, prev, &curr, TRUE);
2099                         _tmp2_ = _tmp8_;
2100                 } else {
2101                         _tmp2_ = FALSE;
2102                 }
2103                 _tmp9_ = _tmp2_;
2104                 if (!_tmp9_) {
2105                         break;
2106                 }
2107         }
2108         _tmp10_ = curr;
2109         _tmp11_ = goal;
2110         result = _tmp10_ == _tmp11_;
2111         _gee_concurrent_list_node_unref0 (curr);
2112         return result;
2113 }
2114
2115
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;
2122         gboolean _result_;
2123         GeeConcurrentListNode* _tmp3_;
2124         g_return_val_if_fail (self != NULL, FALSE);
2125         g_return_val_if_fail (prev_node != NULL, FALSE);
2126         _tmp0_ = prev_node;
2127         _tmp1_ = _gee_concurrent_list_node_ref0 (_tmp0_);
2128         prev = _tmp1_;
2129         _tmp2_ = gee_concurrent_list_node_try_flag (self, &prev);
2130         _result_ = _tmp2_;
2131         _tmp3_ = prev;
2132         if (_tmp3_ != NULL) {
2133                 GeeConcurrentListNode* _tmp4_;
2134                 _tmp4_ = prev;
2135                 gee_concurrent_list_node_help_flagged (self, _tmp4_);
2136         }
2137         result = _result_;
2138         _gee_concurrent_list_node_unref0 (prev);
2139         return result;
2140 }
2141
2142
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);
2146         while (TRUE) {
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_;
2155                 prev_next = _tmp1_;
2156                 _tmp2_ = prev_state;
2157                 if (_tmp2_ == GEE_CONCURRENT_LIST_STATE_FLAGGED) {
2158                         GeeConcurrentListNode* _tmp3_;
2159                         GeeConcurrentListNode* _tmp4_;
2160                         _tmp3_ = prev_next;
2161                         _tmp4_ = prev;
2162                         gee_concurrent_list_node_help_flagged (_tmp3_, _tmp4_);
2163                 } else {
2164                         GeeConcurrentListNode* _tmp5_;
2165                         GeeConcurrentListNode* _tmp6_;
2166                         GeeConcurrentListNode* _tmp7_;
2167                         gboolean _tmp8_ = FALSE;
2168                         gboolean _result_;
2169                         gboolean _tmp9_;
2170                         GeeConcurrentListState _tmp10_ = 0;
2171                         GeeConcurrentListNode* _tmp11_ = NULL;
2172                         GeeConcurrentListState _tmp12_;
2173                         _tmp5_ = next;
2174                         gee_concurrent_list_node_set_succ (self, _tmp5_, GEE_CONCURRENT_LIST_STATE_NONE);
2175                         _tmp6_ = prev;
2176                         _tmp7_ = next;
2177                         _tmp8_ = gee_concurrent_list_node_compare_and_exchange (_tmp6_, _tmp7_, GEE_CONCURRENT_LIST_STATE_NONE, self, GEE_CONCURRENT_LIST_STATE_NONE);
2178                         _result_ = _tmp8_;
2179                         _tmp9_ = _result_;
2180                         if (_tmp9_) {
2181                                 _gee_concurrent_list_node_unref0 (prev_next);
2182                                 _gee_concurrent_list_node_unref0 (prev);
2183                                 return;
2184                         }
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;
2194                                 _tmp14_ = prev;
2195                                 gee_concurrent_list_node_help_flagged (_tmp13_, _tmp14_);
2196                         }
2197                         gee_concurrent_list_node_backtrace (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &prev);
2198                 }
2199                 _tmp15_ = next;
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);
2202         }
2203         _gee_concurrent_list_node_unref0 (prev);
2204 }
2205
2206
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);
2213         _tmp0_ = prev;
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);
2218         }
2219         _tmp2_ = prev;
2220         gee_concurrent_list_node_help_marked (self, _tmp2_);
2221 }
2222
2223
2224 static inline void gee_concurrent_list_node_try_mark (GeeConcurrentListNode* self) {
2225         g_return_if_fail (self != NULL);
2226         {
2227                 gboolean _tmp0_;
2228                 _tmp0_ = TRUE;
2229                 while (TRUE) {
2230                         gboolean _tmp1_;
2231                         GeeConcurrentListNode* _tmp3_ = NULL;
2232                         GeeConcurrentListNode* next_node;
2233                         GeeConcurrentListNode* _tmp4_;
2234                         GeeConcurrentListNode* _tmp5_;
2235                         gboolean _tmp6_ = FALSE;
2236                         gboolean _result_;
2237                         gboolean _tmp7_;
2238                         _tmp1_ = _tmp0_;
2239                         if (!_tmp1_) {
2240                                 GeeConcurrentListState _tmp2_ = 0;
2241                                 _tmp2_ = gee_concurrent_list_node_get_state (self);
2242                                 if (!(_tmp2_ != GEE_CONCURRENT_LIST_STATE_MARKED)) {
2243                                         break;
2244                                 }
2245                         }
2246                         _tmp0_ = FALSE;
2247                         _tmp3_ = gee_concurrent_list_node_get_next (self);
2248                         next_node = _tmp3_;
2249                         _tmp4_ = next_node;
2250                         _tmp5_ = next_node;
2251                         _tmp6_ = gee_concurrent_list_node_compare_and_exchange (self, _tmp4_, GEE_CONCURRENT_LIST_STATE_NONE, _tmp5_, GEE_CONCURRENT_LIST_STATE_MARKED);
2252                         _result_ = _tmp6_;
2253                         _tmp7_ = _result_;
2254                         if (!_tmp7_) {
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_);
2260                                 state = _tmp8_;
2261                                 _gee_concurrent_list_node_unref0 (next_node);
2262                                 next_node = _tmp9_;
2263                                 _tmp10_ = state;
2264                                 if (_tmp10_ == GEE_CONCURRENT_LIST_STATE_FLAGGED) {
2265                                         GeeConcurrentListNode* _tmp11_;
2266                                         _tmp11_ = next_node;
2267                                         gee_concurrent_list_node_help_flagged (self, _tmp11_);
2268                                 }
2269                         }
2270                         _gee_concurrent_list_node_unref0 (next_node);
2271                 }
2272         }
2273 }
2274
2275
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);
2282         _tmp0_ = prev_node;
2283         _tmp1_ = gee_concurrent_list_node_get_next (self);
2284         _tmp2_ = _tmp1_;
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_);
2287 }
2288
2289
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);
2293         while (TRUE) {
2294                 GeeConcurrentListNode* _tmp0_;
2295                 gboolean _tmp1_ = FALSE;
2296                 GeeConcurrentListNode* _tmp2_;
2297                 gboolean _tmp3_ = FALSE;
2298                 gboolean _result_;
2299                 gboolean _tmp4_;
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_;
2307                 gboolean _tmp11_;
2308                 gboolean _tmp12_ = FALSE;
2309                 _tmp0_ = *prev_node;
2310                 _tmp1_ = gee_concurrent_list_node_compare_succ (_tmp0_, self, GEE_CONCURRENT_LIST_STATE_FLAGGED);
2311                 if (_tmp1_) {
2312                         result = FALSE;
2313                         return result;
2314                 }
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);
2317                 _result_ = _tmp3_;
2318                 _tmp4_ = _result_;
2319                 if (_tmp4_) {
2320                         result = TRUE;
2321                         return result;
2322                 }
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;
2332                 } else {
2333                         _tmp8_ = FALSE;
2334                 }
2335                 _tmp11_ = _tmp8_;
2336                 if (_tmp11_) {
2337                         result = FALSE;
2338                         _gee_concurrent_list_node_unref0 (result_node);
2339                         return result;
2340                 }
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);
2343                 if (!_tmp12_) {
2344                         _gee_concurrent_list_node_unref0 (*prev_node);
2345                         *prev_node = NULL;
2346                         result = FALSE;
2347                         _gee_concurrent_list_node_unref0 (result_node);
2348                         return result;
2349                 }
2350                 _gee_concurrent_list_node_unref0 (result_node);
2351         }
2352 }
2353
2354
2355 static inline void gee_concurrent_list_node_backtrace (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeConcurrentListNode** curr) {
2356         while (TRUE) {
2357                 GeeConcurrentListNode* _tmp0_;
2358                 GeeConcurrentListState _tmp1_ = 0;
2359                 GeeConcurrentListNode* _tmp2_;
2360                 GeeConcurrentListNode* _tmp3_ = NULL;
2361                 _tmp0_ = *curr;
2362                 _tmp1_ = gee_concurrent_list_node_get_state (_tmp0_);
2363                 if (!(_tmp1_ == GEE_CONCURRENT_LIST_STATE_MARKED)) {
2364                         break;
2365                 }
2366                 _tmp2_ = *curr;
2367                 _tmp3_ = gee_concurrent_list_node_get_backlink (_tmp2_);
2368                 _gee_concurrent_list_node_unref0 (*curr);
2369                 *curr = _tmp3_;
2370         }
2371 }
2372
2373
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);
2383         _tmp0_ = old_node;
2384         _tmp1_ = new_node;
2385         _tmp2_ = _gee_concurrent_list_node_ref0 (_tmp1_);
2386         _tmp3_ = old_state;
2387         _tmp4_ = new_state;
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_);
2389         result = _tmp5_;
2390         return result;
2391 }
2392
2393
2394 static inline gboolean gee_concurrent_list_node_compare_succ (GeeConcurrentListNode* self, GeeConcurrentListNode* next, GeeConcurrentListState state) {
2395         gboolean result = FALSE;
2396         void* _tmp0_ = NULL;
2397         gsize cur;
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_;
2403         _tmp1_ = next;
2404         _tmp2_ = state;
2405         result = cur == (((gsize) _tmp1_) | ((gsize) _tmp2_));
2406         return result;
2407 }
2408
2409
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);
2415         result = _tmp0_;
2416         return result;
2417 }
2418
2419
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);
2426         return result;
2427 }
2428
2429
2430 static inline GeeConcurrentListNode* gee_concurrent_list_node_get_succ (GeeConcurrentListNode* self, GeeConcurrentListState* state) {
2431         GeeConcurrentListState _vala_state = 0;
2432         GeeConcurrentListNode* result = NULL;
2433         gsize rstate = 0UL;
2434         gsize _tmp0_ = 0UL;
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_);
2440         rstate = _tmp0_;
2441         succ = (GeeConcurrentListNode*) _tmp1_;
2442         _vala_state = (GeeConcurrentListState) rstate;
2443         _tmp2_ = succ;
2444         succ = NULL;
2445         result = _tmp2_;
2446         _gee_concurrent_list_node_unref0 (succ);
2447         if (state) {
2448                 *state = _vala_state;
2449         }
2450         return result;
2451 }
2452
2453
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);
2459         _tmp0_ = next;
2460         _tmp1_ = _gee_concurrent_list_node_ref0 (_tmp0_);
2461         _tmp2_ = state;
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_);
2463 }
2464
2465
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_;
2472         return result;
2473 }
2474
2475
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);
2480         _tmp0_ = backlink;
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);
2483 }
2484
2485
2486 static void gee_concurrent_list_value_node_init (GValue* value) {
2487         value->data[0].v_pointer = NULL;
2488 }
2489
2490
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);
2494         }
2495 }
2496
2497
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);
2501         } else {
2502                 dest_value->data[0].v_pointer = NULL;
2503         }
2504 }
2505
2506
2507 static gpointer gee_concurrent_list_value_node_peek_pointer (const GValue* value) {
2508         return value->data[0].v_pointer;
2509 }
2510
2511
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);
2520                 }
2521                 value->data[0].v_pointer = gee_concurrent_list_node_ref (object);
2522         } else {
2523                 value->data[0].v_pointer = NULL;
2524         }
2525         return NULL;
2526 }
2527
2528
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;
2532         if (!object_p) {
2533                 return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
2534         }
2535         if (!value->data[0].v_pointer) {
2536                 *object_p = NULL;
2537         } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
2538                 *object_p = value->data[0].v_pointer;
2539         } else {
2540                 *object_p = gee_concurrent_list_node_ref (value->data[0].v_pointer);
2541         }
2542         return NULL;
2543 }
2544
2545
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);
2552 }
2553
2554
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;
2558 }
2559
2560
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;
2565         if (v_object) {
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);
2570         } else {
2571                 value->data[0].v_pointer = NULL;
2572         }
2573         if (old) {
2574                 gee_concurrent_list_node_unref (old);
2575         }
2576 }
2577
2578
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;
2583         if (v_object) {
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;
2587         } else {
2588                 value->data[0].v_pointer = NULL;
2589         }
2590         if (old) {
2591                 gee_concurrent_list_node_unref (old);
2592         }
2593 }
2594
2595
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));
2600 }
2601
2602
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;
2606 }
2607
2608
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);
2615 }
2616
2617
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);
2627         }
2628         return gee_concurrent_list_node_type_id__volatile;
2629 }
2630
2631
2632 static gpointer gee_concurrent_list_node_ref (gpointer instance) {
2633         GeeConcurrentListNode* self;
2634         self = instance;
2635         g_atomic_int_inc (&self->ref_count);
2636         return instance;
2637 }
2638
2639
2640 static void gee_concurrent_list_node_unref (gpointer instance) {
2641         GeeConcurrentListNode* self;
2642         self = instance;
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);
2646         }
2647 }
2648
2649
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));
2673         /**
2674          * {@inheritDoc}
2675          */
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));
2677         /**
2678          * {@inheritDoc}
2679          */
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));
2681         /**
2682          * {@inheritDoc}
2683          */
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));
2685 }
2686
2687
2688 static void gee_concurrent_list_instance_init (GeeConcurrentList * self) {
2689         self->priv = GEE_CONCURRENT_LIST_GET_PRIVATE (self);
2690 }
2691
2692
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);
2699         ctx = _tmp0_;
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);
2710 }
2711
2712
2713 /**
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 ]].
2716  *
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.
2720  */
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);
2728         }
2729         return gee_concurrent_list_type_id__volatile;
2730 }
2731
2732
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));
2739                 break;
2740                 case GEE_CONCURRENT_LIST_SIZE:
2741                 g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self));
2742                 break;
2743                 case GEE_CONCURRENT_LIST_IS_EMPTY:
2744                 g_value_set_boolean (value, gee_concurrent_list_get_is_empty (self));
2745                 break;
2746                 default:
2747                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2748                 break;
2749         }
2750 }
2751
2752
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);
2759                 break;
2760                 case GEE_CONCURRENT_LIST_G_DUP_FUNC:
2761                 self->priv->g_dup_func = g_value_get_pointer (value);
2762                 break;
2763                 case GEE_CONCURRENT_LIST_G_DESTROY_FUNC:
2764                 self->priv->g_destroy_func = g_value_get_pointer (value);
2765                 break;
2766                 default:
2767                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2768                 break;
2769         }
2770 }
2771
2772
2773