summaryrefslogtreecommitdiff
path: root/comm/Multiplexer.cc
diff options
context:
space:
mode:
authorchatty1994-05-10 10:02:49 +0000
committerchatty1994-05-10 10:02:49 +0000
commit054510bddc1801d3900fb0c801a0169dd588b466 (patch)
tree94a7c0dcca84f341e2e373caa4c22caea6adcf7f /comm/Multiplexer.cc
parentcbb1752ce6b9b55130d355469111e3aaa1a58433 (diff)
downloadivy-league-054510bddc1801d3900fb0c801a0169dd588b466.zip
ivy-league-054510bddc1801d3900fb0c801a0169dd588b466.tar.gz
ivy-league-054510bddc1801d3900fb0c801a0169dd588b466.tar.bz2
ivy-league-054510bddc1801d3900fb0c801a0169dd588b466.tar.xz
replaced TRUE/FALSE by true/false
Diffstat (limited to 'comm/Multiplexer.cc')
-rw-r--r--comm/Multiplexer.cc37
1 files changed, 21 insertions, 16 deletions
diff --git a/comm/Multiplexer.cc b/comm/Multiplexer.cc
index d3e39cb..ec72cec 100644
--- a/comm/Multiplexer.cc
+++ b/comm/Multiplexer.cc
@@ -14,7 +14,7 @@
#include "Multiplexer.h"
#include "TimeOut.h"
-#include "Signal.h"
+#include "SignalHandler.h"
#include <signal.h> // for NSIG
#include <sys/errno.h>
@@ -32,6 +32,11 @@
#define FD_SET_TYPE(x) (x)
#endif
+#ifdef __osf__
+inline void bzero (char* s, int l) { memset (s, 0, l);}
+extern "C" int select (int, fd_set*, fd_set*, fd_set*, struct timeval*);
+#endif
+
extern int errno;
#ifndef FD_SET
@@ -82,8 +87,8 @@ UchBaseMultiplexer :: UchBaseMultiplexer ()
ReadCount (0),
WriteCount (0),
SelectCount (0),
- Looping (FALSE),
- SigFired (FALSE),
+ Looping (false),
+ SigFired (false),
Handlers (new UchBaseSignalHandler* [NSIG]),
NbSignals (new int [NSIG])
{
@@ -200,7 +205,7 @@ UchBaseMultiplexer :: HandleSignal (UchBaseSignalHandler& h)
{
if (!SigFired)
AddSignalHook ();
- SigFired = TRUE;
+ SigFired = true;
int sig = h.GetSignal () - 1;
/* We have to work with arrays, because we are in a signal
handler, and we cannot use lists */
@@ -289,7 +294,7 @@ void
UchBaseMultiplexer :: Close ()
{
RemoveAll ();
- Looping = FALSE;
+ Looping = false;
}
/*?
@@ -373,8 +378,8 @@ UchMultiplexer :: SetMasks (int fd, IOMODE mode)
/*?
This function calls the select handler of each channel of the set in select mode.
-It returns TRUE as soon as one select handler returns true,
-else it returns FALSE when the select handlers have been called.
+It returns true as soon as one select handler returns true,
+else it returns false when the select handlers have been called.
?*/
bool
UchMultiplexer :: HandleSelect ()
@@ -387,12 +392,12 @@ UchMultiplexer :: HandleSelect ()
if (! FD_ISSET (fd, &SelectMask))
continue;
if (Channels [fd] -> HandleSelect ())
- return TRUE;
+ return true;
nfd--;
if (! Looping)
- return FALSE;
+ return false;
}
- return FALSE;
+ return false;
}
@@ -472,16 +477,16 @@ UchMultiplexer :: Scan (bool nointr, bool poll)
Scan the channels in the set and call the channel's handlers.
First the select handler (\fun{UchChannel::HandleSelect}) of each channel with mode
\var{IOSelect} is called.
-If it returns TRUE, \fun{Scan} exits immediately, while \fun{LoopScan} loops immediately.
-If no select handler returns TRUE, the system call \fun{select} is used to poll or
+If it returns true, \fun{Scan} exits immediately, while \fun{LoopScan} loops immediately.
+If no select handler returns true, the system call \fun{select} is used to poll or
wait for the channels that are ready.
When the select returns normally, the write handlers \fun{HandleWrite} of the
channels in mode \var{IOWrite} that are ready to write are called, and
the read handlers (\fun{HandleRead}) of the channels in mode \fun{IORead}
that are ready to read are called.
-If \var{nointr} is TRUE, ignore the interrupted system calls, else return an error
+If \var{nointr} is true, ignore the interrupted system calls, else return an error
whenever the \fun{select} system call is interrupted.
-If \var{poll} is TRUE, the call is non-blocking, else it is blocking.
+If \var{poll} is true, the call is non-blocking, else it is blocking.
\fun{Scan} calls \fun{select} only once;
it returns -2 if a select handler returns, it returns 0 if the channel set has no active channels,
else it returns the return code of \fun{select}.
@@ -499,7 +504,7 @@ UchMultiplexer :: LoopScan (bool nointr)
{
fd_set rmsk, wmsk;
register int nfd, fd;
- Looping = TRUE;
+ Looping = true;
for (fd0 = 0; Looping; fd0 < NFILE ? fd0++ : (fd0 = 0)) {
@@ -524,7 +529,7 @@ UchMultiplexer :: LoopScan (bool nointr)
if (! Looping)
return isMpxTerminated;
}
- if (nfd) // a handler returned TRUE.
+ if (nfd) // a handler returned true.
continue;
rmsk = ReadMask;