aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/DriveLoop.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Transceiver52M/DriveLoop.cpp')
-rw-r--r--Transceiver52M/DriveLoop.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/Transceiver52M/DriveLoop.cpp b/Transceiver52M/DriveLoop.cpp
index 51ce750..7521a18 100644
--- a/Transceiver52M/DriveLoop.cpp
+++ b/Transceiver52M/DriveLoop.cpp
@@ -33,6 +33,7 @@ DriveLoop::DriveLoop(int wBasePort, const char *TRXAddress,
int wChanM, int wC0, int wSamplesPerSymbol,
GSM::Time wTransmitLatency)
: Thread("DriveLoop")
+, mUseCount(0)
, mClockSocket(wBasePort, TRXAddress, wBasePort + 100)
, mC0(wC0)
{
@@ -85,6 +86,32 @@ DriveLoop::~DriveLoop()
sigProcLibDestroy();
}
+bool DriveLoop::start()
+{
+ // Use count must not be negative
+ assert(mUseCount>=0);
+
+ mUseCount++;
+ if (mUseCount>1)
+ return false;
+
+ startThread();
+ return true;
+}
+
+bool DriveLoop::stop()
+{
+ // Use count must not be negative or zero
+ assert(mUseCount>0);
+
+ mUseCount--;
+ if (mUseCount>0)
+ return false;
+
+ stopThread();
+ return true;
+}
+
void DriveLoop::pushRadioVector(GSM::Time &nowTime)
{
int i;