this is analogous commit fffc5cda10
which fixed the corresponding issue for mutexes.
the robust list can't be used here because the locks do not share a
common layout with mutexes. at some point it may make sense to simply
incorporate a mutex object into the FILE structure and use it, but
that would be a much more invasive change, and it doesn't mesh well
with the current design that uses a simpler code path for internal
locking and pulls in the recursive-mutex-like code when the flockfile
API is used explicitly.
16 lines
240 B
C
16 lines
240 B
C
#include "stdio_impl.h"
|
|
#include "pthread_impl.h"
|
|
|
|
void __unlist_locked_file(FILE *);
|
|
|
|
void funlockfile(FILE *f)
|
|
{
|
|
if (f->lockcount == 1) {
|
|
__unlist_locked_file(f);
|
|
f->lockcount = 0;
|
|
__unlockfile(f);
|
|
} else {
|
|
f->lockcount--;
|
|
}
|
|
}
|