mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
New pthread_barrier algorithm to fulfill barrier destruction requirements.
The previous barrier implementation did not fulfill the POSIX requirements for when a barrier can be destroyed. Specifically, it was possible that threads that haven't noticed yet that their round is complete still access the barrier's memory, and that those accesses can happen after the barrier has been legally destroyed. The new algorithm does not have this issue, and it avoids using a lock internally.
This commit is contained in:
@ -24,15 +24,11 @@
|
||||
int
|
||||
pthread_barrierattr_setpshared (pthread_barrierattr_t *attr, int pshared)
|
||||
{
|
||||
struct pthread_barrierattr *iattr;
|
||||
|
||||
int err = futex_supports_pshared (pshared);
|
||||
if (err != 0)
|
||||
return err;
|
||||
|
||||
iattr = (struct pthread_barrierattr *) attr;
|
||||
|
||||
iattr->pshared = pshared;
|
||||
((struct pthread_barrierattr *) attr)->pshared = pshared;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user