2004-09-16 Antony King <antony.king@st.com>

* libc/time/tzlock.c: Add default stubs that use generic
        locking code.
This commit is contained in:
Jeff Johnston 2004-09-16 21:16:59 +00:00
parent 14613e5e74
commit 5c44c2e546
2 changed files with 24 additions and 7 deletions

View File

@ -1,3 +1,8 @@
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> 2004-09-16 Antony King <antony.king@st.com>
* libc/ctype/ctype.tex: Added missing documentation. * libc/ctype/ctype.tex: Added missing documentation.

View File

@ -17,13 +17,14 @@ TRAD_SYNOPSIS
void __tz_unlock(); void __tz_unlock();
DESCRIPTION DESCRIPTION
The <<tzset>> facility functions call these functions when they need The <<tzset>> facility functions call these functions when they need to
to ensure the values of global variables. The version of these routines supplied ensure the values of global variables. The version of these routines
in the library do not do anything. If multiple threads of execution supplied in the library use the lock API defined in sys/lock.h. If multiple
can call the time functions and give up scheduling in the middle, then you threads of execution can call the time functions and give up scheduling in
you need to define your own versions of these functions in order to the middle, then you you need to define your own versions of these functions
safely lock the time zone variables during a call. If you do not, the results in order to safely lock the time zone variables during a call. If you do
of <<localtime>>, <<mktime>>, <<ctime>>, and <<strftime>> are undefined. not, the results of <<localtime>>, <<mktime>>, <<ctime>>, and <<strftime>>
are undefined.
The lock <<__tz_lock>> may not be called recursively; that is, The lock <<__tz_lock>> may not be called recursively; that is,
a call <<__tz_lock>> will always lock all subsequent <<__tz_lock>> calls 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 <_ansi.h>
#include "local.h" #include "local.h"
#include <sys/lock.h>
#ifndef __SINGLE_THREAD__
__LOCK_INIT(static, __tz_lock_object);
#endif
_VOID _VOID
_DEFUN_VOID (__tz_lock) _DEFUN_VOID (__tz_lock)
{ {
#ifndef __SINGLE_THREAD__
__lock_acquire(__tz_lock_object);
#endif
} }
_VOID _VOID
_DEFUN_VOID (__tz_unlock) _DEFUN_VOID (__tz_unlock)
{ {
#ifndef __SINGLE_THREAD__
__lock_release(__tz_lock_object);
#endif
} }