[icinga-checkins] icinga.org: icinga2/master: Rename the IOTHREADS macro

git at icinga.org git at icinga.org
Tue Feb 16 13:31:04 CET 2016


Module: icinga2
Branch: master
Commit: 9a8458fd677d4e3117abc04e7d094b36e8ec9d3d
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=9a8458fd677d4e3117abc04e7d094b36e8ec9d3d

Author: Gunnar Beutner <gunnar at beutner.name>
Date:   Tue Feb 16 13:30:55 2016 +0100

Rename the IOTHREADS macro

refs #11014

---

 lib/base/socketevents.cpp |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/lib/base/socketevents.cpp b/lib/base/socketevents.cpp
index fbcca5d..0a350b2 100644
--- a/lib/base/socketevents.cpp
+++ b/lib/base/socketevents.cpp
@@ -53,24 +53,24 @@ struct EventDescription
 	Object::Ptr LifesupportReference;
 };
 
-#define IOTHREADS 8
+#define SOCKET_IOTHREADS 8
 
 static boost::once_flag l_SocketIOOnceFlag = BOOST_ONCE_INIT;
-static boost::thread l_SocketIOThreads[IOTHREADS];
+static boost::thread l_SocketIOThreads[SOCKET_IOTHREADS];
 #ifdef __linux__
-static SOCKET l_SocketIOPollFDs[IOTHREADS];
+static SOCKET l_SocketIOPollFDs[SOCKET_IOTHREADS];
 #endif /* __linux__ */
-static SOCKET l_SocketIOEventFDs[IOTHREADS][2];
-static bool l_SocketIOFDChanged[IOTHREADS];
-static boost::mutex l_SocketIOMutex[IOTHREADS];
-static boost::condition_variable l_SocketIOCV[IOTHREADS];
-static std::map<SOCKET, SocketEventDescriptor> l_SocketIOSockets[IOTHREADS];
+static SOCKET l_SocketIOEventFDs[SOCKET_IOTHREADS][2];
+static bool l_SocketIOFDChanged[SOCKET_IOTHREADS];
+static boost::mutex l_SocketIOMutex[SOCKET_IOTHREADS];
+static boost::condition_variable l_SocketIOCV[SOCKET_IOTHREADS];
+static std::map<SOCKET, SocketEventDescriptor> l_SocketIOSockets[SOCKET_IOTHREADS];
 
 int SocketEvents::m_NextID = 0;
 
 void SocketEvents::InitializeThread(void)
 {
-	for (int i = 0; i < IOTHREADS; i++) {
+	for (int i = 0; i < SOCKET_IOTHREADS; i++) {
 #ifdef __linux__
 		l_SocketIOPollFDs[i] = epoll_create1(EPOLL_CLOEXEC);
 #endif /* __linux__ */
@@ -259,7 +259,7 @@ void SocketEvents::ThreadProc(int tid)
 
 void SocketEvents::WakeUpThread(bool wait)
 {
-	int tid = m_ID % IOTHREADS;
+	int tid = m_ID % SOCKET_IOTHREADS;
 
 	if (boost::this_thread::get_id() == l_SocketIOThreads[tid].get_id())
 		return;
@@ -301,7 +301,7 @@ SocketEvents::~SocketEvents(void)
 
 void SocketEvents::Register(Object *lifesupportObject)
 {
-	int tid = m_ID % IOTHREADS;
+	int tid = m_ID % SOCKET_IOTHREADS;
 
 	{
 		boost::mutex::scoped_lock lock(l_SocketIOMutex[tid]);
@@ -339,7 +339,7 @@ void SocketEvents::Register(Object *lifesupportObject)
 
 void SocketEvents::Unregister(void)
 {
-	int tid = m_ID % IOTHREADS;
+	int tid = m_ID % SOCKET_IOTHREADS;
 
 	{
 		boost::mutex::scoped_lock lock(l_SocketIOMutex[tid]);
@@ -366,7 +366,7 @@ void SocketEvents::ChangeEvents(int events)
 	if (m_FD == INVALID_SOCKET)
 		BOOST_THROW_EXCEPTION(std::runtime_error("Tried to read/write from a closed socket."));
 
-	int tid = m_ID % IOTHREADS;
+	int tid = m_ID % SOCKET_IOTHREADS;
 
 #ifdef __linux__
 	epoll_event event;
@@ -400,7 +400,7 @@ void SocketEvents::ChangeEvents(int events)
 
 bool SocketEvents::IsHandlingEvents(void) const
 {
-	int tid = m_ID % IOTHREADS;
+	int tid = m_ID % SOCKET_IOTHREADS;
 	boost::mutex::scoped_lock lock(l_SocketIOMutex[tid]);
 	return m_Events;
 }



More information about the icinga-checkins mailing list