lib/nfs/Blocking, neighbor/smbclient: pass std::chrono::duration to Cond::timed_wait()
This commit is contained in:
parent
837134daef
commit
7ec707927d
@ -22,6 +22,8 @@
|
|||||||
#include "Connection.hxx"
|
#include "Connection.hxx"
|
||||||
#include "event/Call.hxx"
|
#include "event/Call.hxx"
|
||||||
|
|
||||||
|
constexpr std::chrono::steady_clock::duration BlockingNfsOperation::timeout;
|
||||||
|
|
||||||
void
|
void
|
||||||
BlockingNfsOperation::Run()
|
BlockingNfsOperation::Run()
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,8 @@ class NfsConnection;
|
|||||||
* thread, and method Run() waits for completion.
|
* thread, and method Run() waits for completion.
|
||||||
*/
|
*/
|
||||||
class BlockingNfsOperation : protected NfsCallback, NfsLease {
|
class BlockingNfsOperation : protected NfsCallback, NfsLease {
|
||||||
static constexpr unsigned timeout_ms = 60000;
|
static constexpr std::chrono::steady_clock::duration timeout =
|
||||||
|
std::chrono::minutes(1);
|
||||||
|
|
||||||
Mutex mutex;
|
Mutex mutex;
|
||||||
Cond cond;
|
Cond cond;
|
||||||
@ -61,7 +62,7 @@ private:
|
|||||||
bool LockWaitFinished() {
|
bool LockWaitFinished() {
|
||||||
const ScopeLock protect(mutex);
|
const ScopeLock protect(mutex);
|
||||||
while (!finished)
|
while (!finished)
|
||||||
if (!cond.timed_wait(mutex, timeout_ms))
|
if (!cond.timed_wait(mutex, timeout))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -251,7 +251,7 @@ SmbclientNeighborExplorer::ThreadFunc()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// TODO: sleep for how long?
|
// TODO: sleep for how long?
|
||||||
cond.timed_wait(mutex, 10000);
|
cond.timed_wait(mutex, std::chrono::seconds(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
|
Loading…
Reference in New Issue
Block a user