<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 class="Apple-tab-span" style="white-space:pre">        </span>switch_thread_rwlock_rdlock(lock);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>find an item from queue, if not found, create one</div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>switch_thread_rwlock_upgrade_to_wrlock(lock);</div></div><div><br></div></span></div><div>
<span><span class="Apple-tab-span" style="white-space:pre">        </span></span><span>write</span></div><div><span><span class="Apple-tab-span" style="white-space:pre">        </span></span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>switch_thread_rwlock_unlock(lock);</div><div><br></div><div><span>Thanks<br>-- <br>Seven Du<br><div>About: http://about.me/dujinfang</div><div>Blog: http://www.dujinfang.com</div><div>Proj: http://www.freeswitch.org.cn</div>Sent with <a href="http://www.sparrowmailapp.com">Sparrow</a><br></span></div><div></div><div><br></div><div>
</div>
</div>