From bbdc7d6988b7d8742d8784fb5eb17162cd71e83f Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Tue, 26 Dec 2023 23:09:54 +0800 Subject: [PATCH] feat update --- src/ulib/concorrency/barrier.h | 6 ++++ src/ulib/concorrency/condition_variable.h | 4 --- src/ulib/concorrency/event.h | 4 --- src/ulib/concorrency/mutex.h | 16 ++++------ src/ulib/log/level.h | 39 +++++++++++------------ 5 files changed, 31 insertions(+), 38 deletions(-) diff --git a/src/ulib/concorrency/barrier.h b/src/ulib/concorrency/barrier.h index 9efd44e..3080221 100644 --- a/src/ulib/concorrency/barrier.h +++ b/src/ulib/concorrency/barrier.h @@ -1,3 +1,6 @@ +#ifndef ULIB_SRC_ULIB_CONCORRENCY_BARRIER_H_ +#define ULIB_SRC_ULIB_CONCORRENCY_BARRIER_H_ + #include "ulib/concorrency/mutex.h" #include "ulib/concorrency/condition_variable.h" @@ -12,4 +15,7 @@ private: Mutex mutex_; ConditionVariable cond_; }; + }// namespace ulib + +#endif//ULIB_SRC_ULIB_CONCORRENCY_BARRIER_H_ diff --git a/src/ulib/concorrency/condition_variable.h b/src/ulib/concorrency/condition_variable.h index 8d70a03..d01a2e5 100644 --- a/src/ulib/concorrency/condition_variable.h +++ b/src/ulib/concorrency/condition_variable.h @@ -1,7 +1,3 @@ -// -// Created by Feng Zhang on 2023/12/12. -// - #ifndef ULIB_SRC_ULIB_CONCORRENCY_CONDITION_VARIABLE_H_ #define ULIB_SRC_ULIB_CONCORRENCY_CONDITION_VARIABLE_H_ diff --git a/src/ulib/concorrency/event.h b/src/ulib/concorrency/event.h index a348c81..17f85c1 100644 --- a/src/ulib/concorrency/event.h +++ b/src/ulib/concorrency/event.h @@ -1,7 +1,3 @@ -// -// Created by Feng Zhang on 2023/12/13. -// - #ifndef ULIB_SRC_ULIB_CONCORRENCY_EVENT_H_ #define ULIB_SRC_ULIB_CONCORRENCY_EVENT_H_ diff --git a/src/ulib/concorrency/mutex.h b/src/ulib/concorrency/mutex.h index 5e2cbb8..6a93c22 100644 --- a/src/ulib/concorrency/mutex.h +++ b/src/ulib/concorrency/mutex.h @@ -1,7 +1,3 @@ -// -// Created by Feng Zhang on 2023/12/12. -// - #ifndef ULIB_SRC_ULIB_CONCORRENCY_MUTEX_H_ #define ULIB_SRC_ULIB_CONCORRENCY_MUTEX_H_ @@ -10,6 +6,7 @@ namespace ulib { namespace detail { class MutexImpl; } + class Mutex { public: Mutex(); @@ -28,16 +25,17 @@ private: class MutexGuard { public: - MutexGuard(Mutex& ); + MutexGuard(Mutex &); ~MutexGuard(); + private: - MutexGuard(const MutexGuard&); - MutexGuard& operator=(const MutexGuard&); + MutexGuard(const MutexGuard &); + MutexGuard &operator=(const MutexGuard &); friend class ConditionVariable; - Mutex& mutex_; + Mutex &mutex_; }; -} // namespace ulib +}// namespace ulib #endif//ULIB_SRC_ULIB_CONCORRENCY_MUTEX_H_ diff --git a/src/ulib/log/level.h b/src/ulib/log/level.h index dec2af3..5c0c355 100644 --- a/src/ulib/log/level.h +++ b/src/ulib/log/level.h @@ -1,7 +1,3 @@ -// -// Created by tqcq on 2023/12/5. -// - #ifndef ULIB_SRC_LOG_LEVEL_H_ #define ULIB_SRC_LOG_LEVEL_H_ @@ -32,36 +28,37 @@ public: kALL = ULOG_LEVEL_ALL, kOFF = ULOG_LEVEL_OFF, kTrace = ULOG_LEVEL_TRACE, - kDebug= ULOG_LEVEL_DEBUG, + kDebug = ULOG_LEVEL_DEBUG, kInfo = ULOG_LEVEL_INFO, kWarn = ULOG_LEVEL_WARN, kError = ULOG_LEVEL_ERROR, kFatal = ULOG_LEVEL_FATAL, TRACE = ULOG_LEVEL_TRACE, - DEBUG= ULOG_LEVEL_DEBUG, + DEBUG = ULOG_LEVEL_DEBUG, INFO = ULOG_LEVEL_INFO, WARN = ULOG_LEVEL_WARN, ERROR = ULOG_LEVEL_ERROR, FATAL = ULOG_LEVEL_FATAL }; - static const char* ToString(int level) { + static const char *ToString(int level) + { switch (level) { - case kTrace: - return "TRACE"; - case kDebug: - return "DEBUG"; - case kInfo: - return "INFO"; - case kWarn: - return "WARN"; - case kError: - return "ERROR"; - case kFatal: - return "FATAL"; - default: - return "UNKNOWN"; + case kTrace: + return "TRACE"; + case kDebug: + return "DEBUG"; + case kInfo: + return "INFO"; + case kWarn: + return "WARN"; + case kError: + return "ERROR"; + case kFatal: + return "FATAL"; + default: + return "UNKNOWN"; } } };