]> granicus.if.org Git - icinga2/commitdiff
Renamed event/condvar/mutex/thread classes to match other class names.
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 16 Apr 2012 06:36:50 +0000 (08:36 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 16 Apr 2012 06:36:50 +0000 (08:36 +0200)
16 files changed:
base/condvar.cpp
base/condvar.h
base/configcollection.h
base/confighive.h
base/event.h
base/mutex.cpp
base/mutex.h
base/socket.h
base/tcpclient.h
base/tcpserver.h
base/thread.cpp
base/thread.h
base/timer.h
icinga/virtualendpoint.cpp
icinga/virtualendpoint.h
jsonrpc/jsonrpcclient.h

index 7f33ed1b7e7eb850e553a69cb752d26e13010d44..c0c479c4a98a2c9b72f5edfbf66bfd4b7ddc6690 100644 (file)
@@ -2,7 +2,7 @@
 
 using namespace icinga;
 
-condvar::condvar(void)
+CondVar::CondVar(void)
 {
 #ifdef _WIN32
        InitializeConditionVariable(&m_CondVar);
@@ -11,7 +11,7 @@ condvar::condvar(void)
 #endif /* _WIN32 */
 }
 
-condvar::~condvar(void)
+CondVar::~CondVar(void)
 {
 #ifdef _WIN32
        /* nothing to do here */
@@ -20,16 +20,16 @@ condvar::~condvar(void)
 #endif /* _WIN32 */
 }
 
-void condvar::wait(mutex *mtx)
+void CondVar::Wait(Mutex& mtx)
 {
 #ifdef _WIN32
-       SleepConditionVariableCS(&m_CondVar, mtx->get(), INFINITE);
+       SleepConditionVariableCS(&m_CondVar, mtx.Get(), INFINITE);
 #else /* _WIN32 */
-       pthread_cond_wait(&m_CondVar, mtx->get());
+       pthread_cond_wait(&m_CondVar, mtx.Get());
 #endif /* _WIN32 */
 }
 
-void condvar::signal(void)
+void CondVar::Signal(void)
 {
 #ifdef _WIN32
        WakeConditionVariable(&m_CondVar);
@@ -38,7 +38,7 @@ void condvar::signal(void)
 #endif /* _WIN32 */
 }
 
-void condvar::broadcast(void)
+void CondVar::Broadcast(void)
 {
 #ifdef _WIN32
        WakeAllConditionVariable(&m_CondVar);
@@ -49,9 +49,9 @@ void condvar::broadcast(void)
 
 
 #ifdef _WIN32
-CONDITION_VARIABLE *condvar::get(void)
+CONDITION_VARIABLE *CondVar::Get(void)
 #else /* _WIN32 */
-pthread_cond_t *condvar::get(void)
+pthread_cond_t *CondVar::Get(void)
 #endif /* _WIN32 */
 {
        return &m_CondVar;
index 2c51a09ee1932c07fcc934ab00255c2f1d3898bf..03c92b332d1903bfd9ca6b121b57cfe524743dc2 100644 (file)
@@ -4,7 +4,7 @@
 namespace icinga
 {
 
-class I2_BASE_API condvar
+class I2_BASE_API CondVar
 {
 private:
 #ifdef _WIN32
@@ -14,17 +14,17 @@ private:
 #endif /* _WIN32 */
 
 public:
-       condvar(void);
-       ~condvar(void);
+       CondVar(void);
+       ~CondVar(void);
 
-       void wait(mutex *mtx);
-       void signal(void);
-       void broadcast(void);
+       void Wait(Mutex& mtx);
+       void Signal(void);
+       void Broadcast(void);
 
 #ifdef _WIN32
-       CONDITION_VARIABLE *get(void);
+       CONDITION_VARIABLE *Get(void);
 #else /* _WIN32 */
-       pthread_cond_t *get(void);
+       pthread_cond_t *Get(void);
 #endif /* _WIN32 */
 };
 
index b8ea38512c0ddcb1181f8ee8217c1295eebe52ce..ebc00261a5092526012fe2ebb4273438da8d5ea0 100644 (file)
@@ -27,9 +27,9 @@ public:
 
        void ForEachObject(function<int (ConfigObjectEventArgs::Ptr)> callback);
 
-       event<ConfigObjectEventArgs::Ptr> OnObjectCreated;
-       event<ConfigObjectEventArgs::Ptr> OnObjectRemoved;
-       event<ConfigObjectEventArgs::Ptr> OnPropertyChanged;
+       Event<ConfigObjectEventArgs::Ptr> OnObjectCreated;
+       Event<ConfigObjectEventArgs::Ptr> OnObjectRemoved;
+       Event<ConfigObjectEventArgs::Ptr> OnPropertyChanged;
 };
 
 }
index c7e54c33e04164ff3f1636d2f0e018a4529dcbff..95034b2edaf39a312922c2ec52081814129c7cd8 100644 (file)
@@ -20,9 +20,9 @@ public:
 
        void ForEachObject(const string& type, function<int (ConfigObjectEventArgs::Ptr)> callback);
 
-       event<ConfigObjectEventArgs::Ptr> OnObjectCreated;
-       event<ConfigObjectEventArgs::Ptr> OnObjectRemoved;
-       event<ConfigObjectEventArgs::Ptr> OnPropertyChanged;
+       Event<ConfigObjectEventArgs::Ptr> OnObjectCreated;
+       Event<ConfigObjectEventArgs::Ptr> OnObjectRemoved;
+       Event<ConfigObjectEventArgs::Ptr> OnPropertyChanged;
 };
 
 }
index e306d73b02dbc22fd14fad2d400d452b5d24ca70..5785f376fd9b22a9c57015dce753c605df930cdc 100644 (file)
@@ -13,7 +13,7 @@ struct I2_BASE_API EventArgs : public Object
 };
 
 template<class TArgs>
-class event
+class Event
 {
 public:
        typedef function<int (TArgs)> DelegateType;
@@ -22,25 +22,25 @@ private:
        list<DelegateType> m_Delegates;
 
 public:
-       void hook(const DelegateType& delegate)
+       void Hook(const DelegateType& delegate)
        {
                m_Delegates.push_front(delegate);
        }
 
-       void unhook(const DelegateType& delegate)
+       void Unhook(const DelegateType& delegate)
        {
                m_Delegates.remove(delegate);
        }
 
-       event<TArgs>& operator +=(const DelegateType& rhs)
+       Event<TArgs>& operator +=(const DelegateType& rhs)
        {
-               hook(rhs);
+               Hook(rhs);
                return *this;
        }
 
-       event<TArgs>& operator -=(const DelegateType& rhs)
+       Event<TArgs>& operator -=(const DelegateType& rhs)
        {
-               unhook(rhs);
+               Unhook(rhs);
                return *this;
        }
 
index 5a3b596014dc568e64dc154b986e16d6d31aa778..9a49e5b908dd7e8db631a80cb4634d16228370d6 100644 (file)
@@ -2,7 +2,7 @@
 
 using namespace icinga;
 
-mutex::mutex(void)
+Mutex::Mutex(void)
 {
 #ifdef _WIN32
        InitializeCriticalSection(&m_Mutex);
@@ -11,7 +11,7 @@ mutex::mutex(void)
 #endif /* _WIN32 */
 }
 
-mutex::~mutex(void)
+Mutex::~Mutex(void)
 {
 #ifdef _WIN32
        DeleteCriticalSection(&m_Mutex);
@@ -20,7 +20,7 @@ mutex::~mutex(void)
 #endif /* _WIN32 */
 }
 
-bool mutex::tryenter(void)
+bool Mutex::TryEnter(void)
 {
 #ifdef _WIN32
        return (TryEnterCriticalSection(&m_Mutex) == TRUE);
@@ -29,7 +29,7 @@ bool mutex::tryenter(void)
 #endif /* _WIN32 */
 }
 
-void mutex::enter(void)
+void Mutex::Enter(void)
 {
 #ifdef _WIN32
        EnterCriticalSection(&m_Mutex);
@@ -38,7 +38,7 @@ void mutex::enter(void)
 #endif /* _WIN32 */
 }
 
-void mutex::exit(void)
+void Mutex::Exit(void)
 {
 #ifdef _WIN32
        LeaveCriticalSection(&m_Mutex);
@@ -48,9 +48,9 @@ void mutex::exit(void)
 }
 
 #ifdef _WIN32
-CRITICAL_SECTION *mutex::get(void)
+CRITICAL_SECTION *Mutex::Get(void)
 #else /* _WIN32 */
-pthread_mutex_t *mutex::get(void)
+pthread_mutex_t *Mutex::Get(void)
 #endif /* _WIN32 */
 {
        return &m_Mutex;
index 9c632bc04459c14c0d16477236cead3353ada2cf..a0ed1c024e353a8d73f2e456021456c931039baf 100644 (file)
@@ -4,7 +4,7 @@
 namespace icinga
 {
 
-class I2_BASE_API mutex
+class I2_BASE_API Mutex
 {
 private:
 #ifdef _WIN32
@@ -14,17 +14,17 @@ private:
 #endif /* _WIN32 */
 
 public:
-       mutex(void);
-       ~mutex(void);
+       Mutex(void);
+       ~Mutex(void);
 
-       bool tryenter(void);
-       void enter(void);
-       void exit(void);
+       bool TryEnter(void);
+       void Enter(void);
+       void Exit(void);
 
 #ifdef _WIN32
-       CRITICAL_SECTION *get(void);
+       CRITICAL_SECTION *Get(void);
 #else /* _WIN32 */
-       pthread_mutex_t *get(void);
+       pthread_mutex_t *Get(void);
 #endif /* _WIN32 */
 };
 
index 9b9e7da9f1cd2b45a00c46e94ecd9fd3777bc8f4..3f6f51771cc7ef5940c96416a3fa8754e9acf7a5 100644 (file)
@@ -40,12 +40,12 @@ public:
 
        static void CloseAllSockets(void);
 
-       event<EventArgs::Ptr> OnReadable;
-       event<EventArgs::Ptr> OnWritable;
-       event<EventArgs::Ptr> OnException;
+       Event<EventArgs::Ptr> OnReadable;
+       Event<EventArgs::Ptr> OnWritable;
+       Event<EventArgs::Ptr> OnException;
 
-       event<SocketErrorEventArgs::Ptr> OnError;
-       event<EventArgs::Ptr> OnClosed;
+       Event<SocketErrorEventArgs::Ptr> OnError;
+       Event<EventArgs::Ptr> OnClosed;
 
        virtual bool WantsToRead(void) const;
        virtual bool WantsToWrite(void) const;
index 91c027730f89d1cc042e0b0ebbebc6182c325dac..cca15442db7beabe7fe5dde7a0d10abaab9f46dc 100644 (file)
@@ -35,7 +35,7 @@ public:
        virtual bool WantsToRead(void) const;
        virtual bool WantsToWrite(void) const;
 
-       event<EventArgs::Ptr> OnDataAvailable;
+       Event<EventArgs::Ptr> OnDataAvailable;
 };
 
 }
index 44a438d6f9491bc3c5f947b902de0a049e35eca1..7477837d7c43a884527a5f6f6e2015374b8de6a1 100644 (file)
@@ -32,7 +32,7 @@ public:
 
        void Listen(void);
 
-       event<NewClientEventArgs::Ptr> OnNewClient;
+       Event<NewClientEventArgs::Ptr> OnNewClient;
 
        virtual bool WantsToRead(void) const;
 };
index bbf04c5ea8f0b4c8dc1a32623ae973b16f453e36..342c9130088e51d4deea991728cfb0d03e9d17d4 100644 (file)
@@ -4,7 +4,7 @@ using namespace icinga;
 
 typedef struct threadparam_s
 {
-       void (*callback)(void*);
+       ThreadProc callback;
        void *param;
 } threadparam_t;
 
@@ -27,7 +27,7 @@ static void *ThreadStartProc(void *param)
 #endif /* _WIN32 */
 
 
-thread::thread(void (*callback)(void *))
+Thread::Thread(ThreadProc callback)
 {
        threadparam_t *tparam = new threadparam_t();
 
@@ -41,7 +41,7 @@ thread::thread(void (*callback)(void *))
 #endif /* _WIN32 */
 }
 
-thread::~thread(void)
+Thread::~Thread(void)
 {
 #ifdef _WIN32
        CloseHandle(m_Thread);
@@ -49,17 +49,8 @@ thread::~thread(void)
        /* nothing to do here */
 #endif
 }
-       
-void thread::terminate(void)
-{
-#ifdef _WIN32
-       TerminateThread(m_Thread, 0);
-#else /* _WIN32 */
-       /* nothing to do here */
-#endif
-}
 
-void thread::join(void)
+void Thread::Join(void)
 {
 #ifdef _WIN32
        WaitForSingleObject(m_Thread, INFINITE);
index 17a0e993b3e2d0980097ebb8a89525fdd2087921..58c11aa056dc66e62ec7769ecf31e38e95a0dafd 100644 (file)
@@ -4,7 +4,9 @@
 namespace icinga
 {
 
-class I2_BASE_API thread
+typedef void (*ThreadProc)(void *);
+
+class I2_BASE_API Thread
 {
 private:
 #ifdef _WIN32
@@ -14,12 +16,11 @@ private:
 #endif
 
 public:
-       thread(void (*callback)(void *));
-       ~thread(void);
+       Thread(void (*callback)(void *));
+       ~Thread(void);
 
-       void start(void);
-       void terminate(void);
-       void join(void);
+       void Start(void);
+       void Join(void);
 };
 
 }
index da27900afd9026cb3387457b94bac496a94b4fff..4a4e2840b7764262ecb1c3176aa4b709837d5e03 100644 (file)
@@ -49,7 +49,7 @@ public:
 
        void Reschedule(time_t next);
 
-       event<TimerEventArgs::Ptr> OnTimerExpired;
+       Event<TimerEventArgs::Ptr> OnTimerExpired;
 };
 
 }
index c7146d0fc93bd53090c8bfb82362c7db12cf404d..081be6869c8abc58665de293e17e76408c7ac639 100644 (file)
@@ -30,7 +30,7 @@ void VirtualEndpoint::UnregisterMethodSource(string method)
 
 void VirtualEndpoint::SendMessage(Endpoint::Ptr source, JsonRpcMessage::Ptr message)
 {
-       map<string, event<NewMessageEventArgs::Ptr> >::iterator i;
+       map<string, Event<NewMessageEventArgs::Ptr> >::iterator i;
        i = m_MethodHandlers.find(message->GetMethod());
 
        if (i == m_MethodHandlers.end()) {
index 8c94dc92f3d4543ab98a4c5947cae98c7f2e48a0..18fc3eecb6c12a9f5302a34389005400492fcd75 100644 (file)
@@ -7,7 +7,7 @@ namespace icinga
 class I2_ICINGA_API VirtualEndpoint : public Endpoint
 {
 private:
-       map< string, event<NewMessageEventArgs::Ptr> > m_MethodHandlers;
+       map< string, Event<NewMessageEventArgs::Ptr> > m_MethodHandlers;
        list<string> m_MethodSources;
 
 public:
index 408248fbf948b2b0c98332a525d9042028441451..9e4f7cedb212965e324f0bcacda75145a73812fe 100644 (file)
@@ -25,7 +25,7 @@ public:
 
        virtual void Start(void);
 
-       event<NewMessageEventArgs::Ptr> OnNewMessage;
+       Event<NewMessageEventArgs::Ptr> OnNewMessage;
 };
 
 }