IoUringAssmEngn: add assembleFrameReq

Invoke it instimFrameProductionTimesliceInd.

Also, we discovered:
* stream_descriptor::release() doesn't fully release all metadata
  from the fd it was assigned. This suggests that we should go
  through the codebase and do: release()=>reset() whenever we
  wish to release().
* We've confirmed that spinlocks can be used to prevent race
  conditions between stop() and handler methods.
This commit is contained in:
2025-11-06 00:00:23 -04:00
parent 1c7277d141
commit bb59f47549
4 changed files with 258 additions and 16 deletions
+20 -5
View File
@@ -14,6 +14,10 @@
#include <boost/asio/deadline_timer.hpp>
#include <boost/asio/posix/stream_descriptor.hpp>
#include <livoxProto1/device.h>
#include <asynchronousContinuation.h>
#include <asynchronousLoop.h>
#include <callback.h>
#include <spinLock.h>
#include "frameAssemblyDesc.h"
namespace smo {
@@ -29,9 +33,13 @@ public:
bool setup();
void finalize();
void resetAndAssembleFrame(
std::function<void(void*)> onCqeReady);
void stop();
typedef std::function<void(void*, int)> resetAndAssembleFrameCbFn;
void resetAndAssembleFrame(resetAndAssembleFrameCbFn onCqeReady);
void stop(bool doAcquireLock = true);
typedef std::function<void(bool, AsynchronousLoop)> assembleFrameReqCbFn;
void assembleFrameReq(Callback<assembleFrameReqCbFn> cb);
// Telemetry helpers
static size_t computePointsPerDgram(int returnMode);
@@ -57,12 +65,19 @@ private:
// Stall detection timer
boost::asio::deadline_timer stallTimer;
// Callback for CQE notifications (called with user_data from each CQE)
std::function<void(void*)> onCqeReadyCallback;
// Callback for CQE ntfns (called with user_data+result from each CQE)
resetAndAssembleFrameCbFn onCqeReadyCallback;
// Flag to indicate assembly is in progress (cleared by stop())
// Protected by isAssemblingLock
SpinLock isAssemblingLock;
bool isAssembling;
void cancelIncompleteAndFillDummies();
void onEventfdRead(
const boost::system::error_code& error, std::size_t bytes_transferred);
class AssembleFrameReq;
friend class AssembleFrameReq;
};
} // namespace stim_buff