Finally: some align_val_t that did not work on Windows!
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
f160b696fb
commit
1a22a33c0f
@ -1,8 +1,11 @@
|
||||
if(WIN32)
|
||||
set(home $ENV{USERPROFILE})
|
||||
# set(miniconda_dir ${home}\\Miniconda3)
|
||||
set(TARGET_OS_LINKLIBS winmm dsound setupapi ole32 uuid winmm)
|
||||
|
||||
message("Building for Windows")
|
||||
else() # Linux compile
|
||||
message("Building for Linux :)")
|
||||
set(TARGET_OS_LINKLIBS "")
|
||||
endif()
|
||||
|
||||
|
@ -35,6 +35,6 @@ pybind11_add_module(lasp_cpp MODULE lasp_cpp.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(lasp_cpp PRIVATE lasp_device_lib lasp_dsp_lib
|
||||
${OpenMP_CXX_LIBRARIES} ${LASP_FFT_LIBS})
|
||||
${OpenMP_CXX_LIBRARIES} ${LASP_FFT_LIBS} ${TARGET_OS_LINKLIBS})
|
||||
|
||||
install(TARGETS lasp_cpp DESTINATION .)
|
||||
|
@ -26,7 +26,7 @@ DaqData::DaqData(const us nframes, const us nchannels,
|
||||
DEBUGTRACE_PRINT(sw);
|
||||
|
||||
assert(sw > 0 && sw <= 8);
|
||||
_data = new (std::align_val_t{8}) byte_t[sw * nchannels * nframes];
|
||||
_data = reinterpret_cast<byte_t*>(new double[(sw * nchannels * nframes)/8 + 1]);
|
||||
if (!_data) {
|
||||
throw rte("Could not allocate memory for DaqData!");
|
||||
}
|
||||
@ -52,7 +52,7 @@ DaqData::DaqData(DaqData &&o)
|
||||
DaqData::~DaqData() {
|
||||
DEBUGTRACE_ENTER;
|
||||
if (_data)
|
||||
delete[] _data;
|
||||
delete[] (reinterpret_cast<double*>(_data));
|
||||
}
|
||||
|
||||
void DaqData::copyInFromRaw(const std::vector<byte_t *> &ptrs) {
|
||||
|
@ -18,7 +18,7 @@ using std::placeholders::_1;
|
||||
class SafeQueue {
|
||||
std::queue<DaqData> _queue;
|
||||
std::mutex _mtx;
|
||||
std::atomic_int32_t _contents{0};
|
||||
std::atomic<uint32_t> _contents{0};
|
||||
|
||||
public:
|
||||
void push(const DaqData &d) {
|
||||
@ -26,19 +26,20 @@ public:
|
||||
lck lock(_mtx);
|
||||
_queue.push(d);
|
||||
_contents++;
|
||||
assert(_contents == _queue.size());
|
||||
}
|
||||
DaqData pop() {
|
||||
DEBUGTRACE_ENTER;
|
||||
if (empty()) {
|
||||
throw rte("BUG: Pop on empty queue");
|
||||
}
|
||||
}
|
||||
lck lock(_mtx);
|
||||
|
||||
/* DaqData d(std::move(_queue.front())); */
|
||||
DaqData d(_queue.front());
|
||||
_queue.pop();
|
||||
_contents--;
|
||||
|
||||
assert(_contents == _queue.size());
|
||||
return d;
|
||||
}
|
||||
/**
|
||||
@ -81,7 +82,6 @@ void ThreadedInDataHandlerBase::_inCallbackFromInDataHandler(
|
||||
_queue->push(daqdata);
|
||||
if (!_thread_running) {
|
||||
DEBUGTRACE_PRINT("Pushing new thread in pool");
|
||||
_thread_running = true;
|
||||
_pool.push_task(&ThreadedInDataHandlerBase::threadFcn, this);
|
||||
}
|
||||
}
|
||||
@ -115,6 +115,7 @@ ThreadedInDataHandlerBase::~ThreadedInDataHandlerBase() {
|
||||
void ThreadedInDataHandlerBase::threadFcn() {
|
||||
|
||||
DEBUGTRACE_ENTER;
|
||||
_thread_running = true;
|
||||
|
||||
while (!_queue->empty() && _thread_can_safely_run) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user