summaryrefslogtreecommitdiffstats
path: root/Utilities/cmlibuv/src/unix/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities/cmlibuv/src/unix/thread.c')
-rw-r--r--Utilities/cmlibuv/src/unix/thread.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Utilities/cmlibuv/src/unix/thread.c b/Utilities/cmlibuv/src/unix/thread.c
index 8aeb0ca..cbddf17 100644
--- a/Utilities/cmlibuv/src/unix/thread.c
+++ b/Utilities/cmlibuv/src/unix/thread.c
@@ -107,8 +107,7 @@ int uv_barrier_wait(uv_barrier_t* barrier) {
}
last = (--b->out == 0);
- if (!last)
- uv_cond_signal(&b->cond); /* Not needed for last thread. */
+ uv_cond_signal(&b->cond);
uv_mutex_unlock(&b->mutex);
return last;
@@ -122,9 +121,10 @@ void uv_barrier_destroy(uv_barrier_t* barrier) {
uv_mutex_lock(&b->mutex);
assert(b->in == 0);
- assert(b->out == 0);
+ while (b->out != 0)
+ uv_cond_wait(&b->cond, &b->mutex);
- if (b->in != 0 || b->out != 0)
+ if (b->in != 0)
abort();
uv_mutex_unlock(&b->mutex);
@@ -168,7 +168,7 @@ void uv_barrier_destroy(uv_barrier_t* barrier) {
* On Linux, threads created by musl have a much smaller stack than threads
* created by glibc (80 vs. 2048 or 4096 kB.) Follow glibc for consistency.
*/
-static size_t thread_stack_size(void) {
+size_t uv__thread_stack_size(void) {
#if defined(__APPLE__) || defined(__linux__)
struct rlimit lim;
@@ -234,7 +234,7 @@ int uv_thread_create_ex(uv_thread_t* tid,
attr = NULL;
if (stack_size == 0) {
- stack_size = thread_stack_size();
+ stack_size = uv__thread_stack_size();
} else {
pagesize = (size_t)getpagesize();
/* Round up to the nearest page boundary. */