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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user