From e96d6fee64f76b442329f9a8b7360ff4edcfb496 Mon Sep 17 00:00:00 2001 From: Hyotaek Shim Date: Tue, 25 May 2021 14:56:51 +0900 Subject: [PATCH] Add namespace sensor for Autolock Change-Id: Ie5df4a9471cb2dfac519ce37cb195206fe7f5761 Signed-off-by: Hyotaek Shim --- .gitignore | 5 ----- src/shared/cbase_lock.cpp | 2 ++ src/shared/cbase_lock.h | 3 +++ src/shared/channel.cpp | 1 + src/shared/channel.h | 2 +- src/shared/cmutex.cpp | 2 ++ src/shared/cmutex.h | 2 ++ src/shared/event_loop.cpp | 1 + src/shared/event_loop.h | 2 +- 9 files changed, 13 insertions(+), 7 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index fa43b1a..0000000 --- a/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.project -.cproject -.*.swp -nbproject -.vscode \ No newline at end of file diff --git a/src/shared/cbase_lock.cpp b/src/shared/cbase_lock.cpp index a7d7586..6c39497 100644 --- a/src/shared/cbase_lock.cpp +++ b/src/shared/cbase_lock.cpp @@ -24,6 +24,8 @@ #include #include +using namespace sensor; + cbase_lock::cbase_lock() { m_history_mutex = PTHREAD_MUTEX_INITIALIZER; diff --git a/src/shared/cbase_lock.h b/src/shared/cbase_lock.h index 2de5c7e..5c76040 100644 --- a/src/shared/cbase_lock.h +++ b/src/shared/cbase_lock.h @@ -22,6 +22,8 @@ #include +namespace sensor { + enum lock_type { LOCK_TYPE_MUTEX, LOCK_TYPE_READ, @@ -83,5 +85,6 @@ public: Autolock(cbase_lock &m, lock_type type); ~Autolock(); }; +} #endif /* _CBASE_LOCK_H_ */ diff --git a/src/shared/channel.cpp b/src/shared/channel.cpp index 22b0eaa..10ed266 100644 --- a/src/shared/channel.cpp +++ b/src/shared/channel.cpp @@ -30,6 +30,7 @@ #define SYSTEMD_SOCK_BUF_SIZE (128*1024) using namespace ipc; +using namespace sensor; class send_event_handler : public event_handler { diff --git a/src/shared/channel.h b/src/shared/channel.h index bc8444f..5af06da 100644 --- a/src/shared/channel.h +++ b/src/shared/channel.h @@ -74,7 +74,7 @@ private: std::vector m_pending_event_id; std::atomic m_connected; - cmutex m_cmutex; + sensor::cmutex m_cmutex; }; } diff --git a/src/shared/cmutex.cpp b/src/shared/cmutex.cpp index 6245b6e..958835c 100644 --- a/src/shared/cmutex.cpp +++ b/src/shared/cmutex.cpp @@ -20,6 +20,8 @@ #include #include +using namespace sensor; + cmutex::cmutex() { pthread_mutexattr_t mutex_attr; diff --git a/src/shared/cmutex.h b/src/shared/cmutex.h index 94aa2b6..343a260 100644 --- a/src/shared/cmutex.h +++ b/src/shared/cmutex.h @@ -21,6 +21,7 @@ #define _CMUTEX_H_ #include "cbase_lock.h" +namespace sensor { class cmutex : public cbase_lock { public: @@ -39,4 +40,5 @@ private: pthread_mutex_t m_mutex; }; +} #endif /* _CMUTEX_H_ */ diff --git a/src/shared/event_loop.cpp b/src/shared/event_loop.cpp index a49a2e4..e0e9799 100644 --- a/src/shared/event_loop.cpp +++ b/src/shared/event_loop.cpp @@ -33,6 +33,7 @@ #define BAD_HANDLE 0 using namespace ipc; +using namespace sensor; static gboolean g_io_handler(GIOChannel *ch, GIOCondition condition, gpointer data) { diff --git a/src/shared/event_loop.h b/src/shared/event_loop.h index 405f628..40fcb2e 100644 --- a/src/shared/event_loop.h +++ b/src/shared/event_loop.h @@ -98,7 +98,7 @@ private: std::map m_handlers; int m_term_fd; - cmutex m_cmutex; + sensor::cmutex m_cmutex; }; } -- 2.7.4