OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc2/] [newlib/] [libc/] [time/] [tzlock.c] - Diff between revs 207 and 520

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 520
/*
/*
FUNCTION
FUNCTION
<<__tz_lock>>, <<__tz_unlock>>---lock time zone global variables
<<__tz_lock>>, <<__tz_unlock>>---lock time zone global variables
 
 
INDEX
INDEX
        __tz_lock
        __tz_lock
INDEX
INDEX
        __tz_unlock
        __tz_unlock
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include "local.h"
        #include "local.h"
        void __tz_lock (void);
        void __tz_lock (void);
        void __tz_unlock (void);
        void __tz_unlock (void);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        void __tz_lock();
        void __tz_lock();
        void __tz_unlock();
        void __tz_unlock();
 
 
DESCRIPTION
DESCRIPTION
The <<tzset>> facility functions call these functions when they need to
The <<tzset>> facility functions call these functions when they need to
ensure the values of global variables.  The version of these routines
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
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
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
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
in order to safely lock the time zone variables during a call.  If you do
not, the results of <<localtime>>, <<mktime>>, <<ctime>>, and <<strftime>>
not, the results of <<localtime>>, <<mktime>>, <<ctime>>, and <<strftime>>
are undefined.
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
until the corresponding <<__tz_unlock>> call on the same thread is made.
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>
#include <sys/lock.h>
 
 
#ifndef __SINGLE_THREAD__
#ifndef __SINGLE_THREAD__
__LOCK_INIT(static, __tz_lock_object);
__LOCK_INIT(static, __tz_lock_object);
#endif
#endif
 
 
_VOID
_VOID
_DEFUN_VOID (__tz_lock)
_DEFUN_VOID (__tz_lock)
{
{
#ifndef __SINGLE_THREAD__
#ifndef __SINGLE_THREAD__
  __lock_acquire(__tz_lock_object);
  __lock_acquire(__tz_lock_object);
#endif
#endif
}
}
 
 
_VOID
_VOID
_DEFUN_VOID (__tz_unlock)
_DEFUN_VOID (__tz_unlock)
{
{
#ifndef __SINGLE_THREAD__
#ifndef __SINGLE_THREAD__
  __lock_release(__tz_lock_object);
  __lock_release(__tz_lock_object);
#endif
#endif
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.