CubicSDR/src/IOThread.cpp
2015-07-29 22:52:54 -04:00

68 lines
1.2 KiB
C++

#include "IOThread.h"
IOThread::IOThread() {
terminated.store(false);
}
IOThread::~IOThread() {
}
#ifdef __APPLE__
void *IOThread::threadMain() {
terminated.store(false);
run();
return this;
};
void *IOThread::pthread_helper(void *context) {
return ((IOThread *) context)->threadMain();
};
#else
void IOThread::threadMain() {
terminated.store(false);
run();
};
#endif
void IOThread::setup() {
};
void IOThread::run() {
};
void IOThread::terminate() {
terminated.store(true);
};
void IOThread::onBindOutput(std::string name, ThreadQueueBase* threadQueue) {
};
void IOThread::onBindInput(std::string name, ThreadQueueBase* threadQueue) {
};
void IOThread::setInputQueue(std::string qname, ThreadQueueBase *threadQueue) {
input_queues[qname] = threadQueue;
this->onBindInput(qname, threadQueue);
};
void *IOThread::getInputQueue(std::string qname) {
return input_queues[qname];
};
void IOThread::setOutputQueue(std::string qname, ThreadQueueBase *threadQueue) {
output_queues[qname] = threadQueue;
this->onBindOutput(qname, threadQueue);
};
void *IOThread::getOutputQueue(std::string qname) {
return output_queues[qname];
};
bool IOThread::isTerminated() {
return terminated.load();
}