1<html lang="en"> 2<head> 3<title>__tz_lock - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Timefns.html#Timefns" title="Timefns"> 9<link rel="prev" href="time.html#time" title="time"> 10<link rel="next" href="tzset.html#tzset" title="tzset"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<meta http-equiv="Content-Style-Type" content="text/css"> 13<style type="text/css"><!-- 14 pre.display { font-family:inherit } 15 pre.format { font-family:inherit } 16 pre.smalldisplay { font-family:inherit; font-size:smaller } 17 pre.smallformat { font-family:inherit; font-size:smaller } 18 pre.smallexample { font-size:smaller } 19 pre.smalllisp { font-size:smaller } 20 span.sc { font-variant:small-caps } 21 span.roman { font-family:serif; font-weight:normal; } 22 span.sansserif { font-family:sans-serif; font-weight:normal; } 23--></style> 24<link rel="stylesheet" type="text/css" href="../cs.css"> 25</head> 26<body> 27<div class="node"> 28<a name="__tz_lock"></a> 29<a name="g_t_005f_005ftz_005flock"></a> 30<p> 31Next: <a rel="next" accesskey="n" href="tzset.html#tzset">tzset</a>, 32Previous: <a rel="previous" accesskey="p" href="time.html#time">time</a>, 33Up: <a rel="up" accesskey="u" href="Timefns.html#Timefns">Timefns</a> 34<hr> 35</div> 36 37<h3 class="section">8.10 <code>__tz_lock</code>, <code>__tz_unlock</code>—lock time zone global variables</h3> 38 39<p><a name="index-g_t_005f_005ftz_005flock-441"></a><a name="index-g_t_005f_005ftz_005funlock-442"></a><strong>Synopsis</strong> 40<pre class="example"> #include "local.h" 41 void __tz_lock (void); 42 void __tz_unlock (void); 43 44</pre> 45 <p><strong>Description</strong><br> 46The <code>tzset</code> facility functions call these functions when they need to 47ensure the values of global variables. The version of these routines 48supplied in the library use the lock API defined in sys/lock.h. If multiple 49threads of execution can call the time functions and give up scheduling in 50the middle, then you you need to define your own versions of these functions 51in order to safely lock the time zone variables during a call. If you do 52not, the results of <code>localtime</code>, <code>mktime</code>, <code>ctime</code>, and <code>strftime</code> 53are undefined. 54 55 <p>The lock <code>__tz_lock</code> may not be called recursively; that is, 56a call <code>__tz_lock</code> will always lock all subsequent <code>__tz_lock</code> calls 57until the corresponding <code>__tz_unlock</code> call on the same thread is made. 58 59 <p><br> 60 61 </body></html> 62 63