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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [time/] [tzlock.c] - Blame information for rev 326

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/*
2
FUNCTION
3
<<__tz_lock>>, <<__tz_unlock>>---lock time zone global variables
4
 
5
INDEX
6
        __tz_lock
7
INDEX
8
        __tz_unlock
9
 
10
ANSI_SYNOPSIS
11
        #include "local.h"
12
        void __tz_lock (void);
13
        void __tz_unlock (void);
14
 
15
TRAD_SYNOPSIS
16
        void __tz_lock();
17
        void __tz_unlock();
18
 
19
DESCRIPTION
20
The <<tzset>> facility functions call these functions when they need to
21
ensure the values of global variables.  The version of these routines
22
supplied in the library use the lock API defined in sys/lock.h.  If multiple
23
threads of execution can call the time functions and give up scheduling in
24
the middle, then you you need to define your own versions of these functions
25
in order to safely lock the time zone variables during a call.  If you do
26
not, the results of <<localtime>>, <<mktime>>, <<ctime>>, and <<strftime>>
27
are undefined.
28
 
29
The lock <<__tz_lock>> may not be called recursively; that is,
30
a call <<__tz_lock>> will always lock all subsequent <<__tz_lock>> calls
31
until the corresponding <<__tz_unlock>> call on the same thread is made.
32
*/
33
 
34
#include <_ansi.h>
35
#include "local.h"
36
#include <sys/lock.h>
37
 
38
#ifndef __SINGLE_THREAD__
39
__LOCK_INIT(static, __tz_lock_object);
40
#endif
41
 
42
_VOID
43
_DEFUN_VOID (__tz_lock)
44
{
45
#ifndef __SINGLE_THREAD__
46
  __lock_acquire(__tz_lock_object);
47
#endif
48
}
49
 
50
_VOID
51
_DEFUN_VOID (__tz_unlock)
52
{
53
#ifndef __SINGLE_THREAD__
54
  __lock_release(__tz_lock_object);
55
#endif
56
}

powered by: WebSVN 2.1.0

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