treeset.vala \
unfolditerator.vala \
../utils/async.h \
+ ../utils/free.h \
$(NULL)
libgee_0_8_la_VALAFLAGS = \
public static void set_pointer<G> (G **aptr, owned G? new_ptr, size_t mask = 0, size_t new_mask = 0) {
HazardPointer<G>? ptr = exchange_hazard_pointer<G> (aptr, new_ptr, mask, new_mask, null);
if (ptr != null) {
- DestroyNotify<G> notify = get_destroy_notify<G> ();
+ DestroyNotify notify = Utils.Free.get_destroy_notify<G> ();
ptr.release ((owned)notify);
}
}
void *old_rptr = (void *)((size_t)(old_ptr) | (mask & old_mask));
bool success = AtomicPointer.compare_and_exchange((void **)aptr, old_rptr, new_rptr);
if (success) {
- DestroyNotify<G> notify = get_destroy_notify<G> ();
+ DestroyNotify notify = Utils.Free.get_destroy_notify<G> ();
if (old_ptr != null) {
Context.get_current_context ()->release_ptr (old_ptr, (owned)notify);
}
}
}
- public delegate void DestroyNotify (void *ptr);
-
/**
* Release policy determines what happens with object freed by Policy.TRY_RELEASE
* and Policy.RELEASE.
internal static ArrayList<FreeNode *> _global_to_free;
- internal static DestroyNotify get_destroy_notify<G> () {
- return (ptr) => {
- G *gptr = ptr;
- G obj = (owned)gptr;
- obj = null;
- };
- }
-
[Compact]
internal class FreeNode {
public void *pointer;
--- /dev/null
+/* free.h
+ *
+ * Copyright (C) 2013 Maciej Piechotka
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Maciej Piechotka <uzytkownik2@gmail.com>
+ */
+#ifndef GEE_UTILS_ASYNC
+#define GEE_UTILS_ASYNC
+
+#include <glib.h>
+
+#define gee_utils_free_get_destroy_notify(type, dup, destroy) (destroy)
+
+#endif
+
[CCode (cheader_filename = "async.h")]
public async void yield_and_unlock (GLib.Mutex mutex);
}
+ namespace Free {
+ [CCode (cheader_filename = "free.h")]
+ public GLib.DestroyNotify get_destroy_notify<G> ();
+ }
}
}