thread/Cond: add wait() overload which takes a unique_lock<>
Just like std::condition_variable, which however has no way to specify the std::mutex directly.
This commit is contained in:
@@ -238,7 +238,7 @@ SmbclientNeighborExplorer::ThreadFunc() noexcept
|
||||
{
|
||||
SetThreadName("smbclient");
|
||||
|
||||
const std::lock_guard<Mutex> lock(mutex);
|
||||
std::unique_lock<Mutex> lock(mutex);
|
||||
|
||||
while (!quit) {
|
||||
Run();
|
||||
@@ -247,7 +247,7 @@ SmbclientNeighborExplorer::ThreadFunc() noexcept
|
||||
break;
|
||||
|
||||
// TODO: sleep for how long?
|
||||
cond.wait_for(mutex, std::chrono::seconds(10));
|
||||
cond.wait_for(lock, std::chrono::seconds(10));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user