<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                有時候函數使用了局部靜態變量或全局靜態變量,因此不能用于多線程環境,因此無法保證靜態變量在多線程重入時的正確操作。 boost::thread庫使用thread_specific_ptr實現了可移植的線程本地存儲機制(thread local storage,或者是thread specific storage,簡稱tss),使這樣的變量用起來就像每個線程獨立擁有,可以簡化多線程應用,提高性能。 thread_specific_ptr的用法示例如下: ~~~ #include "stdafx.h" #include <iostream> #include <boost/thread.hpp> #include <boost/atomic.hpp> boost::mutex io_mu;//io讀寫鎖 void printing() { boost::thread_specific_ptr<int> pi;//線程本地存儲一個整數 pi.reset(new int());//直接用reset()賦值 for(int i=0;i<5;++i) { ++ (*pi); boost::mutex::scoped_lock lock(io_mu); std::cout<<"thread id:"<<boost::this_thread::get_id()<<" print value(*pi)="<<*pi<<std::endl; } } int _tmain(int argc, _TCHAR* argv[]) { boost::thread thrd1(printing); boost::thread thrd2(printing); thrd1.join(); thrd2.join(); getchar(); return 0; } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看