osmo-trx: Add osmo_signal to stop whole transceiver chain correctly on error
Transceiver::stop() can only be called from either CTRL iface thread or
from main thread (running osmocom loop). That's because stop attempts to
cancel and then join all the other threads, which would then lock if
attempting to stop from some of them.
As a result, the best option is to indicate to the user of the
transceiver option (osmo-trx.cpp) to stop it in a correct fashion by
destroying the object from the main thread.
Change-Id: Iac1d2dbe2328e735db2d4b933cb67b1af1babca1
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h
index f9b54f0..e250adc 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -31,6 +31,7 @@
#include <sys/socket.h>
extern "C" {
+#include <osmocom/core/signal.h>
#include "config_defs.h"
}
@@ -128,6 +129,8 @@
/** accessor for number of channels */
size_t numChans() const { return mChans; };
+ void setSignalHandler(osmo_signal_cbfn cbfn);
+
/** Codes for channel combinations */
typedef enum {
FILL, ///< Channel is transmitted, but unused
@@ -177,6 +180,8 @@
double rssiOffset; ///< RSSI to dBm conversion offset
+ osmo_signal_cbfn *sig_cbfn; ///< Registered Signal Handler to announce events.
+
/** modulate and add a burst to the transmit queue */
void addRadioVector(size_t chan, BitVector &bits,
int RSSI, GSM::Time &wTime);