DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
CallbackGate.hpp File Reference
#include <mutex>
#include <shared_mutex>
#include <utility>
Include dependency graph for CallbackGate.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  dunedaq::dpdklibs::sender::CallbackGate< Owner >

Namespaces

namespace  dunedaq
 The DUNE-DAQ namespace.
namespace  dunedaq::dpdklibs
namespace  dunedaq::dpdklibs::sender

Detailed Description

Callback-lifetime tombstone for process-global callback registries that have no unregister or replace operation. The pinned datahandlinglibs DataMoveCallbackRegistry retains the first registration for an ID for the lifetime of the process.

A registered lambda captures a shared_ptr<CallbackGate<Owner>> rather than a raw owner pointer. The shared_ptr keeps the gate alive for as long as the registry holds the lambda. The owning module controls dispatch:

  • arm(owner): enable dispatch (configure or re-configure).
  • tombstone(): acquire the writer lock, which drains every in-flight dispatch, then disarm. After it returns, no dispatch can reach the owner. Call it before releasing the owner or its DPDK resources.

One-shot contract: destroying a module and creating a replacement with the same callback ID in one process is not supported. The registry would retain the first, permanently tombstoned lambda and drop the data. Re-arming the same gate on the same module instance (configure after scrap) is supported and is the intended lifecycle.

This is part of the DUNE DAQ , copyright 2020. Licensing/copyright details are in the COPYING file that you should have received with this code.

Definition in file CallbackGate.hpp.