This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
cleanup the mutex use of PerlIOStdio_close
Before: clang -Wthread-safety found the flow quite suspect:
one conditional mutex lock, with two conditional unlocks.
The code *looked* like the being okay logic-wise now, but
rather fragile, so let's make it clearer and more solid
by hoisting the locking earlier.
This is a fd close, this should not be a performance sensitive spot.
And it's in PerlIOStdio, so it should be pretty dead anyway.
perlio.c:3283:18: warning: mutex 'PL_perlio_mutex' is not held on every path through here [-Wthread-safety-analysis]
result = PerlSIO_fclose(stdio);
perlio.c:3299:6: warning: releasing mutex 'PL_perlio_mutex' that was not held [-Wthread-safety-analysis]
MUTEX_UNLOCK(&PL_perlio_mutex);