討論串[問題] thread 和 string
共 4 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓2(2推 0噓 9→)留言11則,0人參與, 最新作者yzugsr (Bird)時間16年前 (2009/06/04 11:38), 編輯資訊
0
0
0
內容預覽:
不是吧. 至少VC8, VC9, gcc(SGI)下內建的STL我都trace過. 都是full copy而不是copy on write. 在C++上要依std::string規格實作copy on write其實很複雜. std::string a = "abcde";. std::string
(還有106個字)

推噓1(1推 0噓 1→)留言2則,0人參與, 最新作者adrianshum (Alien)時間16年前 (2009/06/04 10:45), 編輯資訊
0
0
0
內容預覽:
我所知大部份 STL 的 string implementation 都是用 COW的.. 所以, 問題不在於 "new" 是不是 thread safe etc.. 當然, COW 如果有做適當的 synchronization 也是 thread safe 的.. 對於原 po 的問題, 萬一你
(還有80個字)

推噓1(1推 0噓 1→)留言2則,0人參與, 最新作者elfkiller (沒有暱稱)時間16年前 (2009/06/04 02:28), 編輯資訊
0
0
0
內容預覽:
debug 半天發現是 client socket 出問題 .... socket 傳入 thread function 是不是要做什麼保護機制?. 是用 win32 的 CreateThread(); 和 dev c++. 另外問一下 XP 可以模擬出 fork(); 的功能嗎?(不論語言只要能跟

推噓5(5推 0噓 6→)留言11則,0人參與, 最新作者elfkiller (沒有暱稱)時間16年前 (2009/06/03 19:25), 編輯資訊
0
0
0
內容預覽:
void thread_function(){. string xxx;. .... }. 如果像上面一樣在thread裡面建構一個string. 會因為 string 是動態物件. 使得多個 thread 共用到同一個 string 造成 race condition 嗎?. --. 發信站:
首頁
上一頁
1
下一頁
尾頁