锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久婷婷国产综合精品,久久久久久久综合综合狠狠,久久久无码精品亚洲日韩按摩 http://www.shnenglu.com/thisisbin/archive/2009/02/09/73320.html璁告搗鏂?/dc:creator>璁告搗鏂?/author>Mon, 09 Feb 2009 09:59:00 GMThttp://www.shnenglu.com/thisisbin/archive/2009/02/09/73320.htmlhttp://www.shnenglu.com/thisisbin/comments/73320.htmlhttp://www.shnenglu.com/thisisbin/archive/2009/02/09/73320.html#Feedback0http://www.shnenglu.com/thisisbin/comments/commentRss/73320.htmlhttp://www.shnenglu.com/thisisbin/services/trackbacks/73320.html

]]>
瀹炵幇boost::thread涓璕AII椋庢牸鐨勫叡浜攣http://www.shnenglu.com/thisisbin/archive/2009/01/22/72446.html璁告搗鏂?/dc:creator>璁告搗鏂?/author>Thu, 22 Jan 2009 02:22:00 GMThttp://www.shnenglu.com/thisisbin/archive/2009/01/22/72446.htmlhttp://www.shnenglu.com/thisisbin/comments/72446.htmlhttp://www.shnenglu.com/thisisbin/archive/2009/01/22/72446.html#Feedback0http://www.shnenglu.com/thisisbin/comments/commentRss/72446.htmlhttp://www.shnenglu.com/thisisbin/services/trackbacks/72446.html瀹炵幇浠g爜錛?br>

    typedef enum { UNIQUE_LOCK, SHARED_LOCK } LockType;

template<LockType lt>
class shared_lock;

template 
<>
class shared_lock<UNIQUE_LOCK>private boost::noncopyable {
public:
    shared_lock(boost::shared_mutex
& sm): sm_(sm) sm_.lock(); }
    
~shared_lock() { sm_.unlock(); }
private:
    boost::shared_mutex
& sm_;
}
;

template 
<>
class shared_lock<SHARED_LOCK>private boost::noncopyable {
public:
    shared_lock(boost::shared_mutex
& sm): sm_(sm) sm_.lock_shared(); }
    
~shared_lock() { sm_.unlock_shared(); }
private:
    boost::shared_mutex
& sm_;
}
;



璋冪敤鏂瑰紡錛?br>

    boost::shared_mutex session_mutex_;

//鐙崰閿佸畾
shared_lock<UNIQUE_LOCK> lock(session_mutex_);

//鍏變韓閿佸畾
shared_lock<SHARED_LOCK> lock(session_mutex_);


http://www.shnenglu.com/thisisbin/archive/2009/01/21/72417.html 涓鏂?single-write/multi-read 灝卞彲浠ュ簲鐢ㄨ繖縐峈AII椋庢牸鐨勫叡浜攣瀹?/p>

]]>
搴旂敤boost::thread鐨剆hared_mutex瀹炵幇singled_write/multi_read鐨勭畝鍗曚緥瀛?/title><link>http://www.shnenglu.com/thisisbin/archive/2009/01/21/72417.html</link><dc:creator>璁告搗鏂?/dc:creator><author>璁告搗鏂?/author><pubDate>Wed, 21 Jan 2009 05:58:00 GMT</pubDate><guid>http://www.shnenglu.com/thisisbin/archive/2009/01/21/72417.html</guid><wfw:comment>http://www.shnenglu.com/thisisbin/comments/72417.html</wfw:comment><comments>http://www.shnenglu.com/thisisbin/archive/2009/01/21/72417.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/thisisbin/comments/commentRss/72417.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/thisisbin/services/trackbacks/72417.html</trackback:ping><description><![CDATA[    紼嬪簭涓嚑涓嚎紼嬩竴璧峰線鎺у埗鍙板啓鍏og_info錛屼絾鏄彲浠ュ緢娓呮鐨勭湅鍒癰egin or write_process涓嶄細鍚屾椂榪炵畫鐨勫嚭鐜幫紝鑰屼笖鍦╞egin of write_process鍜宔nd of write_process涔嬮棿鑲畾涓嶄細鍑虹幇begin of read_process鎴栬卐nd of read_process銆備絾鏄痓egin of read_process鍗翠細鍦ㄦ帶鍒跺彴涓婅繛緇嚭鐜幫紝榪欒鏄庡湪鍚屼竴鏃跺埢鍙湁涓涓獁rite_prcess鍦ㄨ繍琛岋紝浣嗘槸wrte_process娌℃湁榪愯鐨勬椂鍊欙紝浼氭湁澶氫釜read_process騫跺彂榪愯銆?br><br> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;"> 1</span> <span style="color: #000000;">#include </span><span style="color: #000000;"><</span><span style="color: #000000;">iostream</span><span style="color: #000000;">></span><span style="color: #000000;"><br></span><span style="color: #008080;"> 2</span> <span style="color: #000000;"><br></span><span style="color: #008080;"> 3</span> <span style="color: #000000;">#include </span><span style="color: #000000;"><</span><span style="color: #000000;">boost</span><span style="color: #000000;">/</span><span style="color: #000000;">thread</span><span style="color: #000000;">/</span><span style="color: #000000;">thread.hpp</span><span style="color: #000000;">></span><span style="color: #000000;"><br></span><span style="color: #008080;"> 4</span> <span style="color: #000000;">#include </span><span style="color: #000000;"><</span><span style="color: #000000;">boost</span><span style="color: #000000;">/</span><span style="color: #000000;">thread</span><span style="color: #000000;">/</span><span style="color: #000000;">shared_mutex.hpp</span><span style="color: #000000;">></span><span style="color: #000000;"><br></span><span style="color: #008080;"> 5</span> <span style="color: #000000;"><br></span><span style="color: #008080;"> 6</span> <span style="color: #000000;"></span><span style="color: #0000ff;">using</span><span style="color: #000000;"> </span><span style="color: #0000ff;">namespace</span><span style="color: #000000;"> std;<br></span><span style="color: #008080;"> 7</span> <span style="color: #000000;"></span><span style="color: #0000ff;">using</span><span style="color: #000000;"> </span><span style="color: #0000ff;">namespace</span><span style="color: #000000;"> boost;<br></span><span style="color: #008080;"> 8</span> <span style="color: #000000;"><br></span><span style="color: #008080;"> 9</span> <span style="color: #000000;">boost::shared_mutex shr_mutex;<br></span><span style="color: #008080;">10</span> <span style="color: #000000;"><br></span><span style="color: #008080;">11</span> <span style="color: #000000;"></span><span style="color: #808080;">///</span><span style="color: #008000;"> 榪欎釜鏄緟鍔╃被錛岃兘澶熶繚璇乴og_info琚畬鏁寸殑杈撳嚭</span><span style="color: #808080;"><br></span><span style="color: #008080;">12</span> <span style="color: #808080;"></span><span style="color: #0000ff;">class</span><span style="color: #000000;"> safe_log {<br></span><span style="color: #008080;">13</span> <span style="color: #000000;"></span><span style="color: #0000ff;">public</span><span style="color: #000000;">:<br></span><span style="color: #008080;">14</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">static</span><span style="color: #000000;"> </span><span style="color: #0000ff;">void</span><span style="color: #000000;"> log(</span><span style="color: #0000ff;">const</span><span style="color: #000000;"> std::</span><span style="color: #0000ff;">string</span><span style="color: #000000;">&</span><span style="color: #000000;"> log_info) {<br></span><span style="color: #008080;">15</span> <span style="color: #000000;">        boost::mutex::scoped_lock </span><span style="color: #0000ff;">lock</span><span style="color: #000000;">(log_mutex);<br></span><span style="color: #008080;">16</span> <span style="color: #000000;">        cout </span><span style="color: #000000;"><<</span><span style="color: #000000;"> log_info </span><span style="color: #000000;"><<</span><span style="color: #000000;"> endl;<br></span><span style="color: #008080;">17</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;">18</span> <span style="color: #000000;"><br></span><span style="color: #008080;">19</span> <span style="color: #000000;"></span><span style="color: #0000ff;">private</span><span style="color: #000000;">:<br></span><span style="color: #008080;">20</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">static</span><span style="color: #000000;"> boost::mutex log_mutex;<br></span><span style="color: #008080;">21</span> <span style="color: #000000;">};<br></span><span style="color: #008080;">22</span> <span style="color: #000000;"><br></span><span style="color: #008080;">23</span> <span style="color: #000000;">boost::mutex safe_log::log_mutex;<br></span><span style="color: #008080;">24</span> <span style="color: #000000;"><br></span><span style="color: #008080;">25</span> <span style="color: #000000;"></span><span style="color: #0000ff;">void</span><span style="color: #000000;"> write_process() {<br></span><span style="color: #008080;">26</span> <span style="color: #000000;">    shr_mutex.</span><span style="color: #0000ff;">lock</span><span style="color: #000000;">();<br></span><span style="color: #008080;">27</span> <span style="color: #000000;">    safe_log::log(</span><span style="color: #000000;">"</span><span style="color: #000000;">begin of write_process</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br></span><span style="color: #008080;">28</span> <span style="color: #000000;">    safe_log::log(</span><span style="color: #000000;">"</span><span style="color: #000000;">end of write_process</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br></span><span style="color: #008080;">29</span> <span style="color: #000000;">    shr_mutex.unlock();<br></span><span style="color: #008080;">30</span> <span style="color: #000000;">}<br></span><span style="color: #008080;">31</span> <span style="color: #000000;"><br></span><span style="color: #008080;">32</span> <span style="color: #000000;"></span><span style="color: #0000ff;">void</span><span style="color: #000000;"> read_process() {<br></span><span style="color: #008080;">33</span> <span style="color: #000000;">    shr_mutex.lock_shared();<br></span><span style="color: #008080;">34</span> <span style="color: #000000;">    safe_log::log(</span><span style="color: #000000;">"</span><span style="color: #000000;">begin of read_process</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br></span><span style="color: #008080;">35</span> <span style="color: #000000;">    safe_log::log(</span><span style="color: #000000;">"</span><span style="color: #000000;">end of read_process</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br></span><span style="color: #008080;">36</span> <span style="color: #000000;">    shr_mutex.unlock_shared();<br></span><span style="color: #008080;">37</span> <span style="color: #000000;">}<br></span><span style="color: #008080;">38</span> <span style="color: #000000;"><br></span><span style="color: #008080;">39</span> <span style="color: #000000;"></span><span style="color: #0000ff;">int</span><span style="color: #000000;"> main() {<br></span><span style="color: #008080;">40</span> <span style="color: #000000;"><br></span><span style="color: #008080;">41</span> <span style="color: #000000;">    thread_group threads;<br></span><span style="color: #008080;">42</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> (</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> i </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">; i </span><span style="color: #000000;"><</span><span style="color: #000000;"> </span><span style="color: #000000;">10</span><span style="color: #000000;">; </span><span style="color: #000000;">++</span><span style="color: #000000;"> i) {<br></span><span style="color: #008080;">43</span> <span style="color: #000000;">        threads.create_thread(</span><span style="color: #000000;">&</span><span style="color: #000000;">write_process);<br></span><span style="color: #008080;">44</span> <span style="color: #000000;">        threads.create_thread(</span><span style="color: #000000;">&</span><span style="color: #000000;">read_process);<br></span><span style="color: #008080;">45</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;">46</span> <span style="color: #000000;"><br></span><span style="color: #008080;">47</span> <span style="color: #000000;">    threads.join_all();<br></span><span style="color: #008080;">48</span> <span style="color: #000000;"><br></span><span style="color: #008080;">49</span> <span style="color: #000000;">    ::system(</span><span style="color: #000000;">"</span><span style="color: #000000;">PAUSE</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br></span><span style="color: #008080;">50</span> <span style="color: #000000;"><br></span><span style="color: #008080;">51</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">;<br></span><span style="color: #008080;">52</span> <span style="color: #000000;">}</span></div> <br> <img src ="http://www.shnenglu.com/thisisbin/aggbug/72417.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/thisisbin/" target="_blank">璁告搗鏂?/a> 2009-01-21 13:58 <a href="http://www.shnenglu.com/thisisbin/archive/2009/01/21/72417.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>vs2005涓嬬紪璇戝熀浜巗tlport鐨刡oosthttp://www.shnenglu.com/thisisbin/archive/2008/12/09/68929.html璁告搗鏂?/dc:creator>璁告搗鏂?/author>Tue, 09 Dec 2008 05:22:00 GMThttp://www.shnenglu.com/thisisbin/archive/2008/12/09/68929.htmlhttp://www.shnenglu.com/thisisbin/comments/68929.htmlhttp://www.shnenglu.com/thisisbin/archive/2008/12/09/68929.html#Feedback0http://www.shnenglu.com/thisisbin/comments/commentRss/68929.htmlhttp://www.shnenglu.com/thisisbin/services/trackbacks/68929.html1銆佸畨瑁卻tlport錛屽弬鑰冩枃绔狅細http://www.cnblogs.com/DonLiang/archive/2007/10/13/923143.html
濡傛灉鏄疍EBUG妯″紡璇峰湪欏圭洰鐨勫睘鎬?>閰嶇疆灞炴?>c/c++=>鍛戒護琛岀殑闄勫姞閫夐」澧炲姞/D_STLP_DEBUG

2銆乥oost_1_37_0\tools\jam\stage涓嬭繍琛宐uild.bat緙栬瘧鐢熸垚bjam.exe騫舵嫹璐濆埌boost鏍圭洰褰?br>
3銆佷慨鏀歸厤緗枃浠禸oost_1_37_0\tools\build\v2\user-config.jam錛屽皢涓や釜stlport閫夐」鎵撳紑

4銆乿s2005鍛戒護鎻愮ず涓嬬紪璇戝懡浠わ細bjam stdlib=stlport --build-type=complete install錛屾帴涓嬫潵鏄極闀跨殑絳夊緟錛屽ぇ姒備袱涓皬鏃朵互涓婂惂



]]>
avtt天堂网久久精品| 亚洲国产成人久久一区WWW| 亚洲精品乱码久久久久久蜜桃图片| 四虎影视久久久免费| 狠狠色丁香久久婷婷综合蜜芽五月| 久久久久免费精品国产| 99久久er这里只有精品18| 亚洲伊人久久大香线蕉苏妲己| 久久精品国产国产精品四凭| 伊人久久大香线焦AV综合影院 | 久久久久18| 亚洲综合伊人久久大杳蕉| 国产99久久久国产精免费| 欧美亚洲国产精品久久高清| 7777久久亚洲中文字幕| 最新久久免费视频| 91精品国产91久久久久久蜜臀| 99蜜桃臀久久久欧美精品网站| 亚洲国产精品热久久| 久久久久亚洲AV无码专区体验| 亚洲国产日韩欧美综合久久| 一本久久久久久久| 久久精品国产第一区二区三区| 精品久久久久成人码免费动漫| 国产无套内射久久久国产| 99精品久久精品一区二区| A级毛片无码久久精品免费| 一本大道久久东京热无码AV| 久久99精品国产麻豆婷婷| 久久国产精品-久久精品| 色综合久久中文字幕无码| 久久九九兔免费精品6| 区久久AAA片69亚洲| 国产精品久久新婚兰兰| 四虎国产精品成人免费久久| 亚洲精品WWW久久久久久| 久久精品国产只有精品66| 久久www免费人成看国产片| 久久99精品久久久久久不卡| 久久久久综合中文字幕| 亚洲精品国精品久久99热|