多线程代码段异步访问资源(例如:文件系统)。 为了实现这一点,我将使用条件变量。假设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