Finally: some align_val_t that did not work on Windows!
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Anne de Jong 2023-06-17 07:03:14 -07:00
parent f160b696fb
commit 1a22a33c0f
4 changed files with 11 additions and 7 deletions

View File

@ -1,8 +1,11 @@
if(WIN32) if(WIN32)
set(home $ENV{USERPROFILE}) set(home $ENV{USERPROFILE})
# set(miniconda_dir ${home}\\Miniconda3) # set(miniconda_dir ${home}\\Miniconda3)
set(TARGET_OS_LINKLIBS winmm dsound setupapi ole32 uuid winmm)
message("Building for Windows") message("Building for Windows")
else() # Linux compile else() # Linux compile
message("Building for Linux :)") message("Building for Linux :)")
set(TARGET_OS_LINKLIBS "")
endif() endif()

View File

@ -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 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 .) install(TARGETS lasp_cpp DESTINATION .)

View File

@ -26,7 +26,7 @@ DaqData::DaqData(const us nframes, const us nchannels,
DEBUGTRACE_PRINT(sw); DEBUGTRACE_PRINT(sw);
assert(sw > 0 && sw <= 8); 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) { if (!_data) {
throw rte("Could not allocate memory for DaqData!"); throw rte("Could not allocate memory for DaqData!");
} }
@ -52,7 +52,7 @@ DaqData::DaqData(DaqData &&o)
DaqData::~DaqData() { DaqData::~DaqData() {
DEBUGTRACE_ENTER; DEBUGTRACE_ENTER;
if (_data) if (_data)
delete[] _data; delete[] (reinterpret_cast<double*>(_data));
} }
void DaqData::copyInFromRaw(const std::vector<byte_t *> &ptrs) { void DaqData::copyInFromRaw(const std::vector<byte_t *> &ptrs) {

View File

@ -18,7 +18,7 @@ using std::placeholders::_1;
class SafeQueue { class SafeQueue {
std::queue<DaqData> _queue; std::queue<DaqData> _queue;
std::mutex _mtx; std::mutex _mtx;
std::atomic_int32_t _contents{0}; std::atomic<uint32_t> _contents{0};
public: public:
void push(const DaqData &d) { void push(const DaqData &d) {
@ -26,19 +26,20 @@ public:
lck lock(_mtx); lck lock(_mtx);
_queue.push(d); _queue.push(d);
_contents++; _contents++;
assert(_contents == _queue.size());
} }
DaqData pop() { DaqData pop() {
DEBUGTRACE_ENTER; DEBUGTRACE_ENTER;
if (empty()) { if (empty()) {
throw rte("BUG: Pop on empty queue"); throw rte("BUG: Pop on empty queue");
} }
lck lock(_mtx); lck lock(_mtx);
/* DaqData d(std::move(_queue.front())); */ /* DaqData d(std::move(_queue.front())); */
DaqData d(_queue.front()); DaqData d(_queue.front());
_queue.pop(); _queue.pop();
_contents--; _contents--;
assert(_contents == _queue.size());
return d; return d;
} }
/** /**
@ -81,7 +82,6 @@ void ThreadedInDataHandlerBase::_inCallbackFromInDataHandler(
_queue->push(daqdata); _queue->push(daqdata);
if (!_thread_running) { if (!_thread_running) {
DEBUGTRACE_PRINT("Pushing new thread in pool"); DEBUGTRACE_PRINT("Pushing new thread in pool");
_thread_running = true;
_pool.push_task(&ThreadedInDataHandlerBase::threadFcn, this); _pool.push_task(&ThreadedInDataHandlerBase::threadFcn, this);
} }
} }
@ -115,6 +115,7 @@ ThreadedInDataHandlerBase::~ThreadedInDataHandlerBase() {
void ThreadedInDataHandlerBase::threadFcn() { void ThreadedInDataHandlerBase::threadFcn() {
DEBUGTRACE_ENTER; DEBUGTRACE_ENTER;
_thread_running = true;
while (!_queue->empty() && _thread_can_safely_run) { while (!_queue->empty() && _thread_can_safely_run) {