<p>Unlock the read lock and then lock as a write lock.</p>
<p><blockquote type="cite">On Aug 17, 2011 8:20 PM, &quot;Seven Du&quot; &lt;<a href="mailto:dujinfang@gmail.com">dujinfang@gmail.com</a>&gt; wrote:<br><br><div>
            <div>
                <span>Hi,<br>
                </span></div><div><span><br></span></div><div><span><br></span></div><div><span>Just wondering how to upgrade a read lock to a write lock, say I do a find_or_create_item_in_queue()</span></div><div><span><br>
</span></div><div><span><div><span style="white-space:pre-wrap">        </span>switch_thread_rwlock_rdlock(lock);</div><div><br></div><div><span style="white-space:pre-wrap">        </span>find an item from queue, if not found, create one</div>
<div><br></div><div><div><span style="white-space:pre-wrap">        </span>switch_thread_rwlock_upgrade_to_wrlock(lock);</div></div><div><br></div></span></div><div>
                <span><span style="white-space:pre-wrap">        </span></span><span>write</span></div><div><span><span style="white-space:pre-wrap">        </span></span></div><div><span style="white-space:pre-wrap">        </span>switch_thread_rwlock_unlock(lock);</div>
<div><br></div><div><span>Thanks<br><font color="#888888">-- <br>Seven Du<br><div>About: <a href="http://about.me/dujinfang" target="_blank">http://about.me/dujinfang</a></div><div>Blog: <a href="http://www.dujinfang.com" target="_blank">http://www.dujinfang.com</a></div>
<div>Proj:  <a href="http://www.freeswitch.org.cn" target="_blank">http://www.freeswitch.org.cn</a></div>Sent with <a href="http://www.sparrowmailapp.com" target="_blank">Sparrow</a><br></font></span></div><div></div><div>
<br></div><div>
            </div>
        </div><br>_______________________________________________<br>
Join us at ClueCon 2011, Aug 9-11, Chicago<br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a> 877-7-4ACLUE<br>
<br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></p>