From 0f30d227497418c6d3bef7d52244407e30454504 Mon Sep 17 00:00:00 2001 From: Kacper Date: Mon, 22 Dec 2025 23:27:56 +0100 Subject: Added c11 threads, fixed some locks and add *_unlocked functions --- lib/libc/stdio/getc.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/libc/stdio/getc.c') diff --git a/lib/libc/stdio/getc.c b/lib/libc/stdio/getc.c index 242c8396..2f59ba5c 100644 --- a/lib/libc/stdio/getc.c +++ b/lib/libc/stdio/getc.c @@ -1,9 +1,12 @@ -#include // for weak_reference -#include // for fgetc, FILE, getc, getc_unlocked +#include int getc(FILE *stream) { - return fgetc(stream); -} + int r; + + flockfile(stream); + r = getc_unlocked(stream); + funlockfile(stream); -weak_reference(getc, getc_unlocked); + return r; +} -- cgit v1.2.3