summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdio/getc.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/getc.c')
-rw-r--r--newlib/libc/stdio/getc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/newlib/libc/stdio/getc.c b/newlib/libc/stdio/getc.c
index 5b1fa888a..544ac734c 100644
--- a/newlib/libc/stdio/getc.c
+++ b/newlib/libc/stdio/getc.c
@@ -92,9 +92,11 @@ _DEFUN(_getc_r, (ptr, fp),
{
int result;
CHECK_INIT (ptr, fp);
+ __sfp_lock_acquire ();
_flockfile (fp);
result = __sgetc_r (ptr, fp);
_funlockfile (fp);
+ __sfp_lock_release ();
return result;
}
@@ -106,9 +108,11 @@ _DEFUN(getc, (fp),
{
int result;
CHECK_INIT (_REENT, fp);
+ __sfp_lock_acquire ();
_flockfile (fp);
result = __sgetc_r (_REENT, fp);
_funlockfile (fp);
+ __sfp_lock_release ();
return result;
}