<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Yes, i would use read/write locks. &nbsp;The switch_thread ones are the right ones to use.<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 9, 2015, at 6:13 AM, Sergey Safarov &lt;<a href="mailto:s.safarov@gmail.com" class="">s.safarov@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi&nbsp;Michael<div class="">I has created modified version of switch_load_timezones function in attached file.</div><div class="">I has make first step - "<span style="font-size:12.8000001907349px" class="">swap out the pointers", but do know not how to make correctly thread&nbsp;synchronization. Can you give me reference to function and source file where located mutex protection&nbsp;</span><span style="font-size:12.8000001907349px" class="">of&nbsp;</span><span style="font-size:12.8000001907349px" class="">dialplan reload?</span></div><div class=""><span style="font-size:12.8000001907349px" class=""><br class=""></span></div><div class=""><span style="font-size:12.8000001907349px" class="">I has read&nbsp;apr_thread_mutex_lock and&nbsp;apr_thread_rwlock_rdlock&nbsp;functions description</span></div><div class=""><span style="font-size:12.8000001907349px" class="">apr_thread_mutex_lock &nbsp;</span><span style="font-size:12.8000001907349px" class=""><a href="http://apr.apache.org/docs/apr/1.3/group__apr__thread__mutex.html#g1430fd10d8d260c0e3832c959742a977" class="">http://apr.apache.org/docs/apr/1.3/group__apr__thread__mutex.html#g1430fd10d8d260c0e3832c959742a977</a></span><br class=""></div><div class=""><span style="font-size:12.8000001907349px" class="">apr_thread_rwlock_rdlock &nbsp;</span><span style="font-size:12.8000001907349px" class=""><a href="http://apr.apache.org/docs/apr/1.4/group__apr__thread__rwlock.html#gad44a106cd9a81eef362d31837ca7018f" class="">http://apr.apache.org/docs/apr/1.4/group__apr__thread__rwlock.html#gad44a106cd9a81eef362d31837ca7018f</a></span><br class=""></div><div class=""><span style="font-size:12.8000001907349px" class=""><br class=""></span></div><div class=""><span style="font-size:12.8000001907349px" class="">May be usage switch_thread_rwlock_t datatype and&nbsp;switch_thread_rwlock_rdlock function will be more featured? This allow multiple threads make&nbsp;switch_lookup_timezone.</span></div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Mar 3, 2015 at 10:20 PM, Michael Jerris <span dir="ltr" class="">&lt;<a href="mailto:mike@jerris.com" target="_blank" class="">mike@jerris.com</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">yes it will require code changes there.&nbsp; I wouldn't make an idle loop tho.&nbsp; I would do something to swap out the pointers with the new ones and protect it all with a mutex.&nbsp; I think we do something similar with dialplan reload.<span class=""><div class=""><br class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Mar 3, 2015, at 1:35 PM, Sergey Safarov &lt;<a href="mailto:s.safarov@gmail.com" target="_blank" class="">s.safarov@gmail.com</a>&gt; wrote:</div><br class=""><div class=""><div dir="ltr" class=""><div class="">Will it help addition of the configuration update flag of module&nbsp;<span style="font-size:12.8000001907349px" class="">CORE_SOFTTIMER_MODULE</span>.</div><div class="">And to add idle loop 'into the function switch_lookup_timezone until 'update is complete?</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Mar 3, 2015 at 7:21 PM, Michael Jerris <span dir="ltr" class="">&lt;<a href="mailto:mike@jerris.com" target="_blank" class="">mike@jerris.com</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That is ALWAYS loaded before any other modules, so that not being loaded after.&nbsp; Whats happening here, is the reload signal triggers the timezones to reload asynchronously.&nbsp; This will require a code change to swap those out in some way that doesn't leave them empty for a short period, properly protected against race conditions.&nbsp; This code is in switch_time.c.<br class="">
<div class=""><div class=""><br class="">
<br class="">
&gt; On Mar 3, 2015, at 10:41 AM, Sergey Safarov &lt;<a href="mailto:s.safarov@gmail.com" target="_blank" class="">s.safarov@gmail.com</a>&gt; wrote:<br class="">
&gt;<br class="">
&gt; Please help me declare module dependency<br class="">
&gt; I has extended module radius_cdr by timezone support and from time to time is getting following error<br class="">
&gt;<br class="">
&gt; freeswitch@internal&gt; reload mod_radius_cdr<br class="">
&gt; +OK Reloading XML<br class="">
&gt; +OK module unloaded<br class="">
&gt; +OK module loaded<br class="">
&gt;<br class="">
&gt; 2015-03-03 18:35:34.543407 [CONSOLE] switch_loadable_module.c:1935 Stopping: mod_radius_cdr<br class="">
&gt; 2015-03-03 18:35:34.543407 [CONSOLE] switch_loadable_module.c:1955 mod_radius_cdr unloaded.<br class="">
&gt; 2015-03-03 18:35:34.543407 [INFO] mod_enum.c:880 ENUM Reloaded<br class="">
&gt; 2015-03-03 18:35:34.543407 [ERR] switch_time.c:1324 Timezone 'Asia/Tokyo' not found!<br class="">
&gt; 2015-03-03 18:35:34.543407 [ERR] mod_radius_cdr.c:992 Cannot find timezone Asia/Tokyo<br class="">
&gt; , Setting timezone to GMT<br class="">
&gt; 2015-03-03 18:35:34.543407 [CONSOLE] switch_loadable_module.c:1465 Successfully Loaded [mod_radius_cdr]<br class="">
&gt; 2015-03-03 18:35:34.543407 [INFO] switch_time.c:1369 Timezone reloaded 1781 definitions<br class="">
&gt;<br class="">
&gt;<br class="">
&gt; Module currently depend of loaded configuradion of CORE_SOFTTIMER_MODULE but mod_radius_cdr loaded before loaded CORE_SOFTTIMER_MODULE configuration.<br class="">
&gt;<br class="">
&gt; How can I make sure that CORE_SOFTTIMER_MODULE configuration is loaded&nbsp; before mod_radius_cdr?<br class="">
<br class=""></div></div></blockquote></div></div></div></blockquote></div><br class=""></div></div></span></div></blockquote></div></div></div></blockquote></div><br class=""></div></body></html>