我正在Rust中移植我的C++国际象棋引擎。我有一个在搜索线程之间共享的大型哈希表,在C++版本中,这个表是无锁的;没有用于共享读/写访问的互斥锁。这是,如果你感兴趣的话。在这段代码的Rust版本中,它工作得很好,但使用了一个Mutex
let shared_hash = Arc::new(Mutex::new(new_hash()))
我需要在Rust线程之间共享从C++创建的对象。我已经将它包装在一个Mutex构造中,所以现在可以安全地在线程之间发送它。然而,编译器不让我做什么。= note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Mutexrequired because of the requirements on the impl of `std::marker::Send`
这将挂起除当前使用追加的线程之外的所有传入线程吗?或者其他线程会继续运行而不追加数据吗?{ QMutex mutex; //need to be static so other//there are 10 threads creating an instantiation of classA or an ob