Last change
on this file since 444 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
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 | SYNOPSIS |
---|
11 | #include "local.h" |
---|
12 | void __tz_lock (void); |
---|
13 | void __tz_unlock (void); |
---|
14 | |
---|
15 | DESCRIPTION |
---|
16 | The <<tzset>> facility functions call these functions when they need to |
---|
17 | ensure the values of global variables. The version of these routines |
---|
18 | supplied in the library use the lock API defined in sys/lock.h. If multiple |
---|
19 | threads of execution can call the time functions and give up scheduling in |
---|
20 | the middle, then you you need to define your own versions of these functions |
---|
21 | in order to safely lock the time zone variables during a call. If you do |
---|
22 | not, the results of <<localtime>>, <<mktime>>, <<ctime>>, and <<strftime>> |
---|
23 | are undefined. |
---|
24 | |
---|
25 | The lock <<__tz_lock>> may not be called recursively; that is, |
---|
26 | a call <<__tz_lock>> will always lock all subsequent <<__tz_lock>> calls |
---|
27 | until the corresponding <<__tz_unlock>> call on the same thread is made. |
---|
28 | */ |
---|
29 | |
---|
30 | #include <_ansi.h> |
---|
31 | #include "local.h" |
---|
32 | #include <sys/lock.h> |
---|
33 | |
---|
34 | #ifndef __SINGLE_THREAD__ |
---|
35 | __LOCK_INIT(static, __tz_mutex); |
---|
36 | #endif |
---|
37 | |
---|
38 | void |
---|
39 | __tz_lock (void) |
---|
40 | { |
---|
41 | #ifndef __SINGLE_THREAD__ |
---|
42 | __lock_acquire(__tz_mutex); |
---|
43 | #endif |
---|
44 | } |
---|
45 | |
---|
46 | void |
---|
47 | __tz_unlock (void) |
---|
48 | { |
---|
49 | #ifndef __SINGLE_THREAD__ |
---|
50 | __lock_release(__tz_mutex); |
---|
51 | #endif |
---|
52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.