summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMaciej Piechotka <uzytkownik2@gmail.com>2013-07-27 13:23:18 +0200
committerMaciej Piechotka <uzytkownik2@gmail.com>2013-07-27 13:29:11 +0200
commitfa8bff33b8fadd0f167965cb56809068c5ce7d93 (patch)
tree975a67028ecefb633779883516a7312b775e275a /utils
parent21093533c8550895d211050d3d7259432127b2c9 (diff)
downloadlibgee-fa8bff33b8fadd0f167965cb56809068c5ce7d93.tar.gz
Rework the Futures to a new API
A new API includes the error handling as well as removed redundant functions (such as when_done) which can be replaced by async calls. Future.map, Future.zip and Future.flat_map have also been implemented in terms of Promise.
Diffstat (limited to 'utils')
-rw-r--r--utils/async.h31
-rw-r--r--utils/geeutils.vapi8
2 files changed, 39 insertions, 0 deletions
diff --git a/utils/async.h b/utils/async.h
new file mode 100644
index 0000000..63270e7
--- /dev/null
+++ b/utils/async.h
@@ -0,0 +1,31 @@
+/* async.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_async_yield_and_unlock(mutex, callback, user_data) g_mutex_unlock (mutex)
+#define gee_utils_async_yield_and_unlock_finish(arg) do {} while (0)
+
+#endif
+
diff --git a/utils/geeutils.vapi b/utils/geeutils.vapi
new file mode 100644
index 0000000..451d1e1
--- /dev/null
+++ b/utils/geeutils.vapi
@@ -0,0 +1,8 @@
+namespace Gee {
+ namespace Utils {
+ namespace Async {
+ [CCode (cheader_filename = "async.h")]
+ public async void yield_and_unlock (GLib.Mutex mutex);
+ }
+ }
+}