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
path: root/newlib
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2005-02-08 04:05:50 +0300
committerJeff Johnston <jjohnstn@redhat.com>2005-02-08 04:05:50 +0300
commit3d915670882af692d4a10e1f2559fb7e37194b6b (patch)
treea5950d0c7fb3ec1ca2f079e779990cc1ce9911a6 /newlib
parentb59cab1e2e90ca4ffb19eaf073f03917dc8eb0e9 (diff)
2005-02-07 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdio/findfp.c (__sinit): Protect with new lock. (__sinit_lock): New lock. (__sinit_lock_acquire, __sinit_lock_release): New functions. * libc/stdio/local.h: Add reference to new __sinit locking functions.
Diffstat (limited to 'newlib')
-rw-r--r--newlib/ChangeLog8
-rw-r--r--newlib/libc/stdio/findfp.c22
-rw-r--r--newlib/libc/stdio/local.h4
3 files changed, 34 insertions, 0 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index eed9838c3..32306dc46 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,5 +1,13 @@
2005-02-07 Jeff Johnston <jjohnstn@redhat.com>
+ * libc/stdio/findfp.c (__sinit): Protect with new lock.
+ (__sinit_lock): New lock.
+ (__sinit_lock_acquire, __sinit_lock_release): New functions.
+ * libc/stdio/local.h: Add reference to new __sinit locking
+ functions.
+
+2005-02-07 Jeff Johnston <jjohnstn@redhat.com>
+
* libc/include/math.h (isfinite, isnormal, isunordered): Change
input variable names to avoid mixups with nesting macros.
diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
index a9695ffff..e3270af38 100644
--- a/newlib/libc/stdio/findfp.c
+++ b/newlib/libc/stdio/findfp.c
@@ -163,6 +163,14 @@ _VOID
_DEFUN(__sinit, (s),
struct _reent *s)
{
+ __sinit_lock_acquire ();
+
+ if (s->__sdidinit)
+ {
+ __sinit_lock_release ();
+ return;
+ }
+
/* make sure we clean up on exit */
s->__cleanup = _cleanup_r; /* conservative */
s->__sdidinit = 1;
@@ -192,11 +200,13 @@ _DEFUN(__sinit, (s),
std (s->_stderr, __SWR | __SNBF, 2, s);
+ __sinit_lock_release ();
}
#ifndef __SINGLE_THREAD__
__LOCK_INIT_RECURSIVE(static, __sfp_lock);
+__LOCK_INIT_RECURSIVE(static, __sinit_lock);
_VOID
_DEFUN_VOID(__sfp_lock_acquire)
@@ -210,6 +220,18 @@ _DEFUN_VOID(__sfp_lock_release)
__lock_release_recursive (__sfp_lock);
}
+_VOID
+_DEFUN_VOID(__sinit_lock_acquire)
+{
+ __lock_acquire_recursive (__sinit_lock);
+}
+
+_VOID
+_DEFUN_VOID(__sinit_lock_release)
+{
+ __lock_release_recursive (__sinit_lock);
+}
+
/* Walkable file locking routine. */
static int
_DEFUN(__fp_lock, (ptr),
diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h
index 76c260473..1e132a5d5 100644
--- a/newlib/libc/stdio/local.h
+++ b/newlib/libc/stdio/local.h
@@ -95,7 +95,11 @@ char *_EXFUN(_llicvt,(char *, long long, char));
#ifdef __SINGLE_THREAD__
#define __sfp_lock_acquire()
#define __sfp_lock_release()
+#define __sinit_lock_acquire()
+#define __sinit_lock_release()
#else
_VOID _EXFUN(__sfp_lock_acquire,(_VOID));
_VOID _EXFUN(__sfp_lock_release,(_VOID));
+_VOID _EXFUN(__sinit_lock_acquire,(_VOID));
+_VOID _EXFUN(__sinit_lock_release,(_VOID));
#endif