aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/nfs/Blocking.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-15 00:46:56 +0100
committerMax Kellermann <max@duempel.org>2014-12-15 00:46:56 +0100
commitadfc5db3d2bf0d7df972a687b1510db159b9137c (patch)
treed0b46d10fa1e655211f92f6a5f5f581876a9a0db /src/lib/nfs/Blocking.hxx
parent3f32a6b6071c61543f8a5179fdd6900e1362cbd6 (diff)
parenta48704925d6c3e5c01057192403e55f3663b315c (diff)
downloadmpd-adfc5db3d2bf0d7df972a687b1510db159b9137c.tar.gz
mpd-adfc5db3d2bf0d7df972a687b1510db159b9137c.tar.xz
mpd-adfc5db3d2bf0d7df972a687b1510db159b9137c.zip
Merge branch 'v0.19.x'
Diffstat (limited to 'src/lib/nfs/Blocking.hxx')
-rw-r--r--src/lib/nfs/Blocking.hxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/nfs/Blocking.hxx b/src/lib/nfs/Blocking.hxx
index f8354822d..eb16dfb8c 100644
--- a/src/lib/nfs/Blocking.hxx
+++ b/src/lib/nfs/Blocking.hxx
@@ -35,6 +35,8 @@ class NfsConnection;
* thread, and method Run() waits for completion.
*/
class BlockingNfsOperation : protected NfsCallback, NfsLease {
+ static constexpr unsigned timeout_ms = 60000;
+
Mutex mutex;
Cond cond;
@@ -52,10 +54,13 @@ public:
bool Run(Error &error);
private:
- void LockWaitFinished() {
+ bool LockWaitFinished() {
const ScopeLock protect(mutex);
while (!finished)
- cond.wait(mutex);
+ if (!cond.timed_wait(mutex, timeout_ms))
+ return false;
+
+ return true;
}
/**