From 6eefba812ede29549af3633c490f2e85a4805524 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期三, 31 三月 2021 11:24:20 +0800
Subject: [PATCH] format code style.

---
 utest/util.h |  119 ++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 65 insertions(+), 54 deletions(-)

diff --git a/utest/util.h b/utest/util.h
index ac1d58d..ca58cd7 100644
--- a/utest/util.h
+++ b/utest/util.h
@@ -19,21 +19,21 @@
 #ifndef UTIL_W8A0OA5U
 #define UTIL_W8A0OA5U
 
-#include <functional>
-#include <vector>
-#include <thread>
-#include <stdlib.h>
-#include <chrono>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <boost/noncopyable.hpp>
-#include <boost/timer/timer.hpp>
-#include <boost/test/unit_test.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
+#include "bh_util.h"
+#include "msg.h"
 #include "shm.h"
 #include "shm_queue.h"
-#include "msg.h"
-#include "bh_util.h"
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/test/unit_test.hpp>
+#include <boost/timer/timer.hpp>
+#include <chrono>
+#include <functional>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <thread>
+#include <vector>
 
 using namespace boost::posix_time;
 inline ptime Now() { return second_clock::universal_time(); };
@@ -42,58 +42,69 @@
 
 typedef std::function<void(void)> FuncVV;
 
-class ScopeCall : private boost::noncopyable {
-    FuncVV f_;
+class ScopeCall : private boost::noncopyable
+{
+	FuncVV f_;
+
 public:
-    ScopeCall(FuncVV f):f_(f) { f_(); }
-    ~ScopeCall() { f_(); }
+	ScopeCall(FuncVV f) :
+	    f_(f) { f_(); }
+	~ScopeCall() { f_(); }
 };
-class ThreadManager {
-    std::vector<std::thread> threads_;
+class ThreadManager
+{
+	std::vector<std::thread> threads_;
+
 public:
-    ~ThreadManager() { WaitAll(); }
-    template <class T, class...P>
-    void Launch(T t, P...p) { threads_.emplace_back(t, p...); }
-    void WaitAll() {
-        for (auto &t : threads_) {
-            if (t.joinable()) {
-                t.join();
-            }
-        }
-    }
+	~ThreadManager() { WaitAll(); }
+	template <class T, class... P>
+	void Launch(T t, P... p) { threads_.emplace_back(t, p...); }
+	void WaitAll()
+	{
+		for (auto &t : threads_) {
+			if (t.joinable()) {
+				t.join();
+			}
+		}
+	}
 };
-class ProcessManager {
-    std::vector<pid_t> procs_;
+class ProcessManager
+{
+	std::vector<pid_t> procs_;
+
 public:
-    ~ProcessManager() { WaitAll(); }
-    template <class T, class ...P>
-    void Launch(T t, P...p) {
-        auto pid = fork();
-        if (pid == 0) {
-            // child
-            t(p...);
-            exit(0);
-        } else if (pid != -1) { // Ok
-            procs_.push_back(pid);
-        }
-    };
-    void WaitAll() {
-        for (auto &pid: procs_) {
-            int status = 0;
-            int options = WUNTRACED | WCONTINUED;
-            waitpid(pid, &status, options);
-        }
-        procs_.clear();
-    }
+	~ProcessManager() { WaitAll(); }
+	template <class T, class... P>
+	void Launch(T t, P... p)
+	{
+		auto pid = fork();
+		if (pid == 0) {
+			// child
+			t(p...);
+			exit(0);
+		} else if (pid != -1) { // Ok
+			procs_.push_back(pid);
+		}
+	};
+	void WaitAll()
+	{
+		for (auto &pid : procs_) {
+			int status = 0;
+			int options = WUNTRACED | WCONTINUED;
+			waitpid(pid, &status, options);
+		}
+		procs_.clear();
+	}
 };
 
 using namespace bhome_shm;
 using namespace bhome_msg;
 
 struct ShmRemover {
-    std::string name_;
-    ShmRemover(const std::string &name):name_(name) { SharedMemory::Remove(name_); }
-    ~ShmRemover() { SharedMemory::Remove(name_); }
+	std::string name_;
+	ShmRemover(const std::string &name) :
+	    name_(name) { SharedMemory::Remove(name_); }
+	~ShmRemover() { SharedMemory::Remove(name_); }
 };
 
 #endif // end of include guard: UTIL_W8A0OA5U

--
Gitblit v1.8.0