diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2004-09-16 21:16:59 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2004-09-16 21:16:59 +0000 |
commit | 5c44c2e54639389e7b72d6307ca0a5863bfe142b (patch) | |
tree | 0af88c2a3ab8fb566870e100f22f6795cd8cfc01 /newlib | |
parent | 14613e5e74b633aeaa4f69e7ea096074ba94cb1f (diff) | |
download | newlib-5c44c2e54639389e7b72d6307ca0a5863bfe142b.zip newlib-5c44c2e54639389e7b72d6307ca0a5863bfe142b.tar.gz newlib-5c44c2e54639389e7b72d6307ca0a5863bfe142b.tar.bz2 |
2004-09-16 Antony King <antony.king@st.com>
* libc/time/tzlock.c: Add default stubs that use generic
locking code.
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 5 | ||||
-rw-r--r-- | newlib/libc/time/tzlock.c | 26 |
2 files changed, 24 insertions, 7 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 09843bf..c24d76c 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,5 +1,10 @@ 2004-09-16 Antony King <antony.king@st.com> + * libc/time/tzlock.c: Add default stubs that use generic + locking code. + +2004-09-16 Antony King <antony.king@st.com> + * libc/ctype/ctype.tex: Added missing documentation. * libc/stdio/stdio.tex Ditto. * libc/stdlib/stdlib.tex Ditto. diff --git a/newlib/libc/time/tzlock.c b/newlib/libc/time/tzlock.c index 66fa1c3..f3c2896 100644 --- a/newlib/libc/time/tzlock.c +++ b/newlib/libc/time/tzlock.c @@ -17,13 +17,14 @@ TRAD_SYNOPSIS void __tz_unlock(); DESCRIPTION -The <<tzset>> facility functions call these functions when they need -to ensure the values of global variables. The version of these routines supplied -in the library do not do anything. If multiple threads of execution -can call the time functions and give up scheduling in the middle, then you -you need to define your own versions of these functions in order to -safely lock the time zone variables during a call. If you do not, the results -of <<localtime>>, <<mktime>>, <<ctime>>, and <<strftime>> are undefined. +The <<tzset>> facility functions call these functions when they need to +ensure the values of global variables. The version of these routines +supplied in the library use the lock API defined in sys/lock.h. If multiple +threads of execution can call the time functions and give up scheduling in +the middle, then you you need to define your own versions of these functions +in order to safely lock the time zone variables during a call. If you do +not, the results of <<localtime>>, <<mktime>>, <<ctime>>, and <<strftime>> +are undefined. The lock <<__tz_lock>> may not be called recursively; that is, a call <<__tz_lock>> will always lock all subsequent <<__tz_lock>> calls @@ -32,13 +33,24 @@ until the corresponding <<__tz_unlock>> call on the same thread is made. #include <_ansi.h> #include "local.h" +#include <sys/lock.h> + +#ifndef __SINGLE_THREAD__ +__LOCK_INIT(static, __tz_lock_object); +#endif _VOID _DEFUN_VOID (__tz_lock) { +#ifndef __SINGLE_THREAD__ + __lock_acquire(__tz_lock_object); +#endif } _VOID _DEFUN_VOID (__tz_unlock) { +#ifndef __SINGLE_THREAD__ + __lock_release(__tz_lock_object); +#endif } |