projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix TCS* definitions in mips termios.h
[musl]
/
src
/
thread
/
pthread_barrier_wait.c
diff --git
a/src/thread/pthread_barrier_wait.c
b/src/thread/pthread_barrier_wait.c
index
4a964fe
..
06b83db
100644
(file)
--- a/
src/thread/pthread_barrier_wait.c
+++ b/
src/thread/pthread_barrier_wait.c
@@
-1,8
+1,5
@@
#include "pthread_impl.h"
#include "pthread_impl.h"
-void __vm_lock_impl(int);
-void __vm_unlock_impl(void);
-
static int pshared_barrier_wait(pthread_barrier_t *b)
{
int limit = (b->_b_limit & INT_MAX) + 1;
static int pshared_barrier_wait(pthread_barrier_t *b)
{
int limit = (b->_b_limit & INT_MAX) + 1;
@@
-26,7
+23,7
@@
static int pshared_barrier_wait(pthread_barrier_t *b)
__wait(&b->_b_count, &b->_b_waiters2, v, 0);
}
__wait(&b->_b_count, &b->_b_waiters2, v, 0);
}
- __vm_lock
_impl(+1
);
+ __vm_lock
(
);
/* Ensure all threads have a vm lock before proceeding */
if (a_fetch_add(&b->_b_count, -1)==1-limit) {
/* Ensure all threads have a vm lock before proceeding */
if (a_fetch_add(&b->_b_count, -1)==1-limit) {
@@
-47,17
+44,17
@@
static int pshared_barrier_wait(pthread_barrier_t *b)
if (v==INT_MIN+1 || (v==1 && w))
__wake(&b->_b_lock, 1, 0);
if (v==INT_MIN+1 || (v==1 && w))
__wake(&b->_b_lock, 1, 0);
- __vm_unlock
_impl
();
+ __vm_unlock();
return ret;
}
struct instance
{
return ret;
}
struct instance
{
- int count;
- int last;
- int waiters;
- int finished;
+
volatile
int count;
+
volatile
int last;
+
volatile
int waiters;
+
volatile
int finished;
};
int pthread_barrier_wait(pthread_barrier_t *b)
};
int pthread_barrier_wait(pthread_barrier_t *b)
@@
-79,7
+76,7
@@
int pthread_barrier_wait(pthread_barrier_t *b)
/* First thread to enter the barrier becomes the "instance owner" */
if (!inst) {
struct instance new_inst = { 0 };
/* First thread to enter the barrier becomes the "instance owner" */
if (!inst) {
struct instance new_inst = { 0 };
- int spins =
100
00;
+ int spins =
2
00;
b->_b_inst = inst = &new_inst;
a_store(&b->_b_lock, 0);
if (b->_b_waiters) __wake(&b->_b_lock, 1, 1);
b->_b_inst = inst = &new_inst;
a_store(&b->_b_lock, 0);
if (b->_b_waiters) __wake(&b->_b_lock, 1, 1);