From 6e0af74f4518bfbf7cb3455767d831b347ea8c78 Mon Sep 17 00:00:00 2001 From: chatty Date: Tue, 28 Nov 2000 17:07:44 +0000 Subject: * Smart(ies) removed by Stephane Sire * added Hooks --- comm/Multiplexer.h | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'comm') diff --git a/comm/Multiplexer.h b/comm/Multiplexer.h index ee52c91..e955130 100644 --- a/comm/Multiplexer.h +++ b/comm/Multiplexer.h @@ -15,9 +15,8 @@ #ifndef UchMultiplexer_H_ #define UchMultiplexer_H_ -//#include "dnn/Multiplexer.h" -#include "Loop.h" -#include "../UCH/Channel.h" +#include "dnn/Loop.h" +#include "Channel.h" #include #include "ccu/Timer.h" @@ -33,7 +32,7 @@ extern char* StrReprBuf; // // WARNING: when the Multiplexer is deleted, the Channels it still -// has in its channel set are not Removed; instead UchChannel::Removed +// have in its channel set are not Removed; instead UchChannel::Removed // is called typedef DnnMpxHook UchMpxHook; @@ -42,20 +41,21 @@ class UchBaseMultiplexer : public DnnBaseMultiplexer { friend class UchBaseTimeOut; friend class UchBaseSignalHandler; friend class UchChannel; +friend MPX_RES UchLoop (); protected: - bool Add (UchChannel*); - bool Remove (int); - UchChannel** Channels; CcuTimerSet Timers; short ReadCount; short WriteCount; short SelectCount; - bool SigFired; - int* NbSignals; + bool Looping; + bool SigFired; UchBaseSignalHandler** Handlers; + int* NbSignals; + bool Add (UchChannel*); + bool Remove (int); void HandleSignal (UchBaseSignalHandler&); void HandleDeferredSignals (); inline CcuTimerSet* GetTimerSet () { return &Timers; } @@ -70,18 +70,16 @@ public: ~UchBaseMultiplexer (); UchChannel* operator [] (int); - + void RemoveAll (); void SetMode (int, IOMODE); MPX_RES Run (); -#if 0 void Abort (); void Close (); -#endif - }; + class UchMultiplexer : public UchBaseMultiplexer { protected: fd_set ReadMask; @@ -98,11 +96,13 @@ protected: MPX_RES Loop (); void ExecHooks (bool = false); + public: UchMultiplexer (); ~UchMultiplexer (); MPX_RES LoopScan (bool nointr = true); + int Scan (bool nointr = true, bool poll = false); void Stop (); char* StrRepr (char* = StrReprBuf); void AddHook (DnnMpxHook*, bool = false); @@ -111,6 +111,9 @@ public: void RemoveFinalHook (DnnMpxHook*); }; -#endif /* Multiplexer_H_ */ - +extern UchBaseMultiplexer* UchMpx; +extern void UchOpen (UchBaseMultiplexer* = 0); +extern MPX_RES UchLoop (); +extern void UchStop (); +#endif /* UchMultiplexer_H_ */ -- cgit v1.1