summaryrefslogtreecommitdiff
path: root/deps/uv/include/pthread-barrier.h
diff options
context:
space:
mode:
authorSaúl Ibarra Corretgé <saghul@gmail.com>2016-05-17 00:25:23 +0200
committerSaúl Ibarra Corretgé <saghul@gmail.com>2016-05-17 02:28:48 +0200
commitb78a7043699093c46d5d71992184f4c40ab5c4b5 (patch)
tree7ee0fc8474ae60c4be545965ae18882ef1964027 /deps/uv/include/pthread-barrier.h
parentf293d0b0c85b2d1b9e0d3938dd38cf1cacac6970 (diff)
downloadandroid-node-v8-b78a7043699093c46d5d71992184f4c40ab5c4b5.tar.gz
android-node-v8-b78a7043699093c46d5d71992184f4c40ab5c4b5.tar.bz2
android-node-v8-b78a7043699093c46d5d71992184f4c40ab5c4b5.zip
deps: upgrade libuv to 1.9.1
Fixes: https://github.com/nodejs/node/issues/4002 Fixes: https://github.com/nodejs/node/issues/5384 Fixes: https://github.com/nodejs/node/issues/6563 Refs: https://github.com/nodejs/node/issues/2680#issuecomment-213521708 PR-URL: https://github.com/nodejs/node/pull/6796 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/uv/include/pthread-barrier.h')
-rw-r--r--deps/uv/include/pthread-barrier.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/deps/uv/include/pthread-barrier.h b/deps/uv/include/pthread-barrier.h
new file mode 100644
index 0000000000..084e1c2d55
--- /dev/null
+++ b/deps/uv/include/pthread-barrier.h
@@ -0,0 +1,64 @@
+/*
+Copyright (c) 2016, Kari Tristan Helgason <kthelgason@gmail.com>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#ifndef _UV_PTHREAD_BARRIER_
+#define _UV_PTHREAD_BARRIER_
+#include <errno.h>
+#include <pthread.h>
+#include <semaphore.h> /* sem_t */
+
+#define PTHREAD_BARRIER_SERIAL_THREAD 0x12345
+
+/*
+ * To maintain ABI compatibility with
+ * libuv v1.x struct is padded according
+ * to target platform
+ */
+#if defined(__ANDROID__)
+# define UV_BARRIER_STRUCT_PADDING \
+ sizeof(pthread_mutex_t) + \
+ sizeof(pthread_cond_t) + \
+ sizeof(unsigned int) - \
+ sizeof(void *)
+#elif defined(__APPLE__)
+# define UV_BARRIER_STRUCT_PADDING \
+ sizeof(pthread_mutex_t) + \
+ 2 * sizeof(sem_t) + \
+ 2 * sizeof(unsigned int) - \
+ sizeof(void *)
+#endif
+
+typedef struct {
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ unsigned threshold;
+ unsigned in;
+ unsigned out;
+} _uv_barrier;
+
+typedef struct {
+ _uv_barrier* b;
+ char _pad[UV_BARRIER_STRUCT_PADDING];
+} pthread_barrier_t;
+
+int pthread_barrier_init(pthread_barrier_t* barrier,
+ const void* barrier_attr,
+ unsigned count);
+
+int pthread_barrier_wait(pthread_barrier_t* barrier);
+int pthread_barrier_destroy(pthread_barrier_t *barrier);
+
+#endif /* _UV_PTHREAD_BARRIER_ */