作為C++的初學者,面臨的一個很大的問題,就是很多的概念并不是可以通過名稱直觀的預知它要完成的細節,比如這里的condition_variable的wait_for。C++的設計意圖好像是,我告訴你這樣用,你只要這樣做就行,又簡單還實用!而且需要記住的規則量又大的驚人。最后看起來,更像是給人工只能開發的開發語言,而不象是給人這種具有因果邏輯的生物而設計的。所以這種設計其實更不容易使用,因為每次使用,使用者腦子里都需要轉換一下他兩個之間的關系!
https://en.cppreference.com/w/cpp/thread/condition_variable/wait_for
wait_for causes the current thread to block until the condition variable is notified, the given duration has been elapsed, or a spurious wakeup occurs. pred can be optionally provided to detect spurious