]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/dmclock/support/src/run_every.cc
update sources to v12.1.0
[ceph.git] / ceph / src / dmclock / support / src / run_every.cc
index 258baaa74c041bf3b6d0159b85c1135a82009fa5..cab414109a9dc6fcc648fff7873d432961d29cdb 100644 (file)
@@ -1,12 +1,10 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
 // vim: ts=8 sw=2 smarttab
 /*
- * Copyright (C) 2016 Red Hat Inc.
+ * Copyright (C) 2017 Red Hat Inc.
  */
 
 
-#include <iostream>
-
 #include "run_every.h"
 
 
@@ -53,8 +51,17 @@ crimson::RunEvery& crimson::RunEvery::operator=(crimson::RunEvery&& other)
 
 
 crimson::RunEvery::~RunEvery() {
-  finishing = true;
-  cv.notify_all();
+  join();
+}
+
+
+void crimson::RunEvery::join() {
+  {
+    Guard l(mtx);
+    if (finishing) return;
+    finishing = true;
+    cv.notify_all();
+  }
   thd.join();
 }