blob: 6806cf8b32e0c13f1b67c2d920e8485a94c42f42 [file] [log] [blame]
Rich Felker5eb0d332011-03-12 21:55:45 -05001#include "stdio_impl.h"
2#include "pthread_impl.h"
3
Rich Felkerc1014a82018-04-18 00:16:12 -04004void __register_locked_file(FILE *, pthread_t);
Rich Felkerc21f7502018-04-17 23:59:41 -04005
Rich Felker5eb0d332011-03-12 21:55:45 -05006void flockfile(FILE *f)
7{
Rich Felkerc1014a82018-04-18 00:16:12 -04008 if (!ftrylockfile(f)) return;
9 __lockfile(f);
10 __register_locked_file(f, __pthread_self());
Rich Felker5eb0d332011-03-12 21:55:45 -050011}