CubicSDR/src/IOThread.cpp

69 lines
1.3 KiB
C++
Raw Normal View History

2015-07-29 20:57:02 -04:00
#include "IOThread.h"
IOThread::IOThread() {
terminated.store(false);
}
IOThread::~IOThread() {
}
#ifdef __APPLE__
void *IOThread::threadMain() {
terminated.store(false);
2015-07-29 20:57:02 -04:00
run();
return this;
};
void *IOThread::pthread_helper(void *context) {
return ((IOThread *) context)->threadMain();
};
#else
void IOThread::threadMain() {
terminated.store(false);
2015-07-29 20:57:02 -04:00
run();
};
#endif
void IOThread::setup() {
};
void IOThread::run() {
};
void IOThread::terminate() {
terminated.store(true);
};
2016-01-28 15:49:40 -05:00
void IOThread::onBindOutput(std::string /* name */, ThreadQueueBase* /* threadQueue */) {
2015-07-29 20:57:02 -04:00
};
2016-01-28 15:49:40 -05:00
void IOThread::onBindInput(std::string /* name */, ThreadQueueBase* /* threadQueue */) {
2015-07-29 20:57:02 -04:00
};
void IOThread::setInputQueue(std::string qname, ThreadQueueBase *threadQueue) {
input_queues[qname] = threadQueue;
this->onBindInput(qname, threadQueue);
};
ThreadQueueBase *IOThread::getInputQueue(std::string qname) {
2015-07-29 20:57:02 -04:00
return input_queues[qname];
};
void IOThread::setOutputQueue(std::string qname, ThreadQueueBase *threadQueue) {
output_queues[qname] = threadQueue;
this->onBindOutput(qname, threadQueue);
};
ThreadQueueBase *IOThread::getOutputQueue(std::string qname) {
2015-07-29 20:57:02 -04:00
return output_queues[qname];
};
bool IOThread::isTerminated() {
return terminated.load();
2016-01-28 15:49:40 -05:00
}