多線程代碼段異步訪問資源(例如:文件系統)。 爲了實現這一點,我將使用條件變量。假設FileSystem是一個接口,如: class FileSystem {
// sends a read request to the fileSystem
read(String fileName) {
// ...
// upon completion, execu
我想使用Boost庫同步兩個線程(在相同的C++映射上工作)。我必須告訴我,我不是C++的專家,我覺得boost文檔很難理解。 我想實現什麼,是這樣的: #Thread 1
get access to the map
put in something
release access
#Thread 2
wait until map is empty
when it's not empt