[sheepdog] [PATCH v2 01/11] sheep: add helper functions to check the current thread

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Fri Apr 19 09:14:50 CEST 2013


Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/sheep_priv.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index bb7a522..e7a453a 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -206,6 +206,16 @@ extern struct store_driver *sd_store;
 extern char *obj_path;
 extern char *epoch_path;
 
+static inline bool is_main_thread(void)
+{
+	return gettid() == getpid();
+}
+
+static inline bool is_worker_thread(void)
+{
+	return !is_main_thread();
+}
+
 /* One should call this function to get sys->epoch outside main thread */
 static inline uint32_t sys_epoch(void)
 {
-- 
1.8.1.3.566.gaa39828




More information about the sheepdog mailing list