Date: Wednesday, August 30, 2006 @ 12:17:59
Author: marc
Path: /cvsroot/carob/carob
Modified: Makefile (1.44 -> 1.45) src/ControllerPinger.cpp (1.3 -> 1.4)
Renamed USE_POLL/USING_POLL to CAROB_USE_POLL to avoid collisions and for
consistency.
Fixed and moved example in Makefile.
--------------------------+
Makefile | 8 +++++---
src/ControllerPinger.cpp | 20 ++++++++++----------
2 files changed, 15 insertions(+), 13 deletions(-)
Index: carob/Makefile
diff -u carob/Makefile:1.44 carob/Makefile:1.45
--- carob/Makefile:1.44 Wed Aug 30 09:38:05 2006
+++ carob/Makefile Wed Aug 30 12:17:59 2006
@@ -62,6 +62,11 @@
# mandatory CXXFLAGS
override CXXFLAGS += -I${INCDIR}
+# Uncomment this line to use poll function instead of select
+# Or using the command line: make CXXFLAGS=-DCAROB_USE_POLL
+# (Warning, optional feature not deeply tested)
+# override CXXFLAGS += -DCAROB_USE_POLL
+
# LDFLAGS is not used for _static_ libcarob.a
# optional LDFLAGS
LDFLAGS = -lpthread
@@ -80,9 +85,6 @@
#CXXFLAGS += -DCAROB_USE_LOG4CXX
#LDFLAGS += -llog4cxx
-# Uncomment this line to use poll function instead of select (Warning, feature
not deeply tested)
-#CXXFLAGS += -DUSE_POLL
-
#Doc
# DOC_DIR is duplicated in Doxyfile
DOC_DIR = doxygen
Index: carob/src/ControllerPinger.cpp
diff -u carob/src/ControllerPinger.cpp:1.3 carob/src/ControllerPinger.cpp:1.4
--- carob/src/ControllerPinger.cpp:1.3 Wed Aug 30 09:37:12 2006
+++ carob/src/ControllerPinger.cpp Wed Aug 30 12:17:59 2006
@@ -17,9 +17,9 @@
*
* Initial developer(s): Gilles Rayrat
* Contributor(s): Marc Herbert, Zsolt Simon
- * #ifdef USING_POLL
+#ifdef CAROB_USE_POLL
* Contributors += Bruno Corsi dos Santos
- * #endif
+#endif
*/
#include "ControllerPinger.hpp"
@@ -28,7 +28,7 @@
#include "Common.hpp"
#include "Connection.hpp"
-#ifdef USING_POLL
+#ifdef CAROB_USE_POLL
#include <sys/poll.h>
#define POLL_FUNCTION L"Poll"
#else
@@ -147,7 +147,7 @@
// list of suspected controllers we can connect to
std::vector<SuspectController> suspected_and_connected_controllers;
-#ifdef USING_POLL
+#ifdef CAROB_USE_POLL
//create the structures to use poll syscall
unsigned int nfds = 0;
unsigned int maxnfds = suspected_controllers.size();
@@ -195,7 +195,7 @@
suspected_and_connected_controllers.push_back(sc);
// add its socket to the polling set
int sock = sc.pingSocketPtr->getFd();
-#ifdef USING_POLL
+#ifdef CAROB_USE_POLL
ufds[nfds].fd = sock;
ufds[nfds].events = POLLOUT;
nfds++;
@@ -212,7 +212,7 @@
delete sc.pingSocketPtr;
}
}
-#ifdef USING_POLL
+#ifdef CAROB_USE_POLL
retVal = poll(ufds, nfds, poll_timeout_ms);
#else
retVal = select(fdMax+1, NULL, &writableControllers, NULL, &tv);
@@ -231,13 +231,13 @@
if (retVal > 0)
{
// iterates through controller list to find the ones that are up again
-#ifdef USING_POLL
+#ifdef CAROB_USE_POLL
int i=0;
#endif
for (std::vector<SuspectController>::iterator iter =
suspected_and_connected_controllers.begin();
iter != suspected_and_connected_controllers.end(); iter++)
{
-#ifdef USING_POLL
+#ifdef CAROB_USE_POLL
if (ufds[i].revents & POLLOUT)
#else
if (FD_ISSET(iter->pingSocketPtr->getFd(), &writableControllers))
@@ -248,7 +248,7 @@
iter->pingSocketPtr->writeJavaInt(Ping);
removeControllerFromSuspectList(iter->controllerInfo);
}
-#ifdef USING_POLL
+#ifdef CAROB_USE_POLL
i++;
#endif
}
@@ -261,7 +261,7 @@
delete iter->pingSocketPtr;
}
suspected_and_connected_controllers.clear();
-#ifdef USING_POLL
+#ifdef CAROB_USE_POLL
free(ufds);
#endif
}
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits