Fully initialize allocated memory for the new barrier. The
b_destroying member was left uninitialized, which caused spurious EBUSY. PR: 197365 Noted by: Florent Guiliani <fguiliani@verisign.com> Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
78a786f909
commit
83d74204c8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=278313
@ -86,16 +86,13 @@ _pthread_barrier_init(pthread_barrier_t *barrier,
|
||||
if (barrier == NULL || count <= 0)
|
||||
return (EINVAL);
|
||||
|
||||
bar = malloc(sizeof(struct pthread_barrier));
|
||||
bar = calloc(1, sizeof(struct pthread_barrier));
|
||||
if (bar == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
_thr_umutex_init(&bar->b_lock);
|
||||
_thr_ucond_init(&bar->b_cv);
|
||||
bar->b_cycle = 0;
|
||||
bar->b_waiters = 0;
|
||||
bar->b_count = count;
|
||||
bar->b_refcount = 0;
|
||||
*barrier = bar;
|
||||
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user