[問題] 多執行緒存取資料庫問題
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
vc
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
mysql
問題(Question):
當c程式有多個thread,同時對db的 某 table做寫入時,
需要自己加lock嗎?還是資料庫會自己處理,不需自己介入?
如 thread 1 對 test table的 row 1做update
thread 2 對 test table的 row 3做update
thread 3 對 test table的 row 2做update
my_thread()
{
lock(mylock)
{
update_db();
}
}
在my_thread()裡的 lock 需要加嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 27.100.69.4
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1472297542.A.E26.html
→
08/27 22:27, , 1F
08/27 22:27, 1F
→
08/27 22:28, , 2F
08/27 22:28, 2F
→
08/28 04:39, , 3F
08/28 04:39, 3F
→
08/28 07:23, , 4F
08/28 07:23, 4F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章