Correctly handle the race itself, too (don't leave it locked).
This is about to be replaced anyway by initialization explicitly instead of lazily, and reducing the complexity of it. As it is now, this will work fine, however.
This commit is contained in:
parent
575ee59b1c
commit
77bc7b795e
@ -99,6 +99,7 @@ init_lock(FILE *fp)
|
||||
}
|
||||
if (fp->_lock != NULL) { /* lost the race */
|
||||
free(p);
|
||||
_pthread_mutex_unlock(&init_lock_mutex);
|
||||
return (0);
|
||||
}
|
||||
fp->_lock = p;
|
||||
|
Loading…
x
Reference in New Issue
Block a user