4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-18 20:39:33 +08:00
Freddie Chopin 0eeb4c1d32 Unify names of all lock objects
In preparation for the patch that would allow retargeting of locking
routines, rename all lock objects to follow this pattern:

"__<name>_[recursive_]mutex".

Following locks were renamed:
__dd_hash_lock -> __dd_hash_mutex
__sfp_lock -> __sfp_recursive_mutex
__sinit_lock -> __sinit_recursive_mutex
__atexit_lock -> __atexit_recursive_mutex
_arc4random_mutex -> __arc4random_mutex
__env_lock_object -> __env_recursive_mutex
__malloc_lock_object -> __malloc_recursive_mutex
__atexit_mutex -> __at_quick_exit_mutex
__tz_lock_object -> __tz_mutex
2017-02-06 16:55:09 -05:00

57 lines
1.3 KiB
C

/*
FUNCTION
<<__tz_lock>>, <<__tz_unlock>>---lock time zone global variables
INDEX
__tz_lock
INDEX
__tz_unlock
ANSI_SYNOPSIS
#include "local.h"
void __tz_lock (void);
void __tz_unlock (void);
TRAD_SYNOPSIS
void __tz_lock();
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 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
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_mutex);
#endif
_VOID
_DEFUN_VOID (__tz_lock)
{
#ifndef __SINGLE_THREAD__
__lock_acquire(__tz_mutex);
#endif
}
_VOID
_DEFUN_VOID (__tz_unlock)
{
#ifndef __SINGLE_THREAD__
__lock_release(__tz_mutex);
#endif
}