Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowi@redhat.com>2014-12-15 21:22:56 +0300
committerYaakov Selkowitz <yselkowi@redhat.com>2014-12-15 21:22:56 +0300
commit6485fc66f2fada39e681ad316352f60a17ac1367 (patch)
treeff01497d054390325e76ac7adb0307279a4bf9e1 /newlib/libc/stdio/local.h
parentf5ce72dffc738d43213e566d8ae082d7428f8be9 (diff)
* libc/include/stdio.h (__SNLK): Define.
* libc/include/stdio_ext.h (FSETLOCKING_QUERY, FSETLOCKING_INTERNAL, FSETLOCKING_BYCALLER): Define. (__fsetlocking): Declare. * libc/stdio/Makefile.am: Build fsetlocking.c. * libc/stdio/Makefile.in: Regenerate. * libc/stdio/fsetlocking.c: New file. * libc/stdio/local.h (_newlib_flockfile_start): Make _flockfile call dependent on __SNLK flag. (_newlib_flockfile_exit, _newlib_flockfile_end): Ditto for _funlockfile calls. Define all locking macros as empty if __SINGLE_THREAD__. * libc/stdio/stdio.tex: Include fsetlocking.def.
Diffstat (limited to 'newlib/libc/stdio/local.h')
-rw-r--r--newlib/libc/stdio/local.h29
1 files changed, 22 insertions, 7 deletions
diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h
index 24d21360e..434d3f85c 100644
--- a/newlib/libc/stdio/local.h
+++ b/newlib/libc/stdio/local.h
@@ -68,16 +68,19 @@
{ \
int __oldfpcancel; \
pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &__oldfpcancel); \
- _flockfile (_fp)
+ if (!(_fp->_flags2 & __SNLK)) \
+ _flockfile (_fp)
/* Exit from a stream oriented critical section prematurely: */
# define _newlib_flockfile_exit(_fp) \
- _funlockfile (_fp); \
+ if (!(_fp->_flags2 & __SNLK)) \
+ _funlockfile (_fp); \
pthread_setcancelstate (__oldfpcancel, &__oldfpcancel);
/* End a stream oriented critical section: */
# define _newlib_flockfile_end(_fp) \
- _funlockfile (_fp); \
+ if (!(_fp->_flags2 & __SNLK)) \
+ _funlockfile (_fp); \
pthread_setcancelstate (__oldfpcancel, &__oldfpcancel); \
}
@@ -99,17 +102,20 @@
pthread_setcancelstate (__oldsfpcancel, &__oldsfpcancel); \
}
-#else /* !_STDIO_WITH_THREAD_CANCELLATION_SUPPORT */
+#elif !defined(__SINGLE_THREAD__) /* !_STDIO_WITH_THREAD_CANCELLATION_SUPPORT */
# define _newlib_flockfile_start(_fp) \
{ \
- _flockfile(_fp)
+ if (!(_fp->_flags2 & __SNLK)) \
+ _flockfile (_fp)
# define _newlib_flockfile_exit(_fp) \
- _funlockfile(_fp); \
+ if (!(_fp->_flags2 & __SNLK)) \
+ _funlockfile(_fp); \
# define _newlib_flockfile_end(_fp) \
- _funlockfile(_fp); \
+ if (!(_fp->_flags2 & __SNLK)) \
+ _funlockfile(_fp); \
}
# define _newlib_sfp_lock_start() \
@@ -123,6 +129,15 @@
__sfp_lock_release (); \
}
+#else /* __SINGLE_THREAD__ */
+
+# define _newlib_flockfile_start(_fp)
+# define _newlib_flockfile_exit(_fp)
+# define _newlib_flockfile_end(_fp)
+# define _newlib_sfp_lock_start()
+# define _newlib_sfp_lock_exit()
+# define _newlib_sfp_lock_end()
+
#endif /* _STDIO_WITH_THREAD_CANCELLATION_SUPPORT */
extern u_char *_EXFUN(__sccl, (char *, u_char *fmt));