Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1906 | serge | 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 | 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 < |
||
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 < |
||
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 |
||
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 | }<__tz_unlock><__tz_lock><__tz_lock><__tz_lock> |