lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::Fabrics::EventQueue Class Reference

Wraps a libfabric event queue (fid_eq). More...

#include <Endpoint.hh>

Inherits Pds::Fabrics::ErrorHandler.

Public Member Functions

 EventQueue (Fabric *fabric, size_t size=0)
 Open an event queue of the given size with an unspecified wait object; up() reports success.
 
 EventQueue (Fabric *fabric, struct fi_eq_attr *eq_attr, void *context)
 Open an event queue with caller-supplied attributes and context; up() reports success.
 
 ~EventQueue ()
 Close the queue if it is up.
 
struct fid_eq * eq () const
 Return the underlying fid_eq.
 
bool event (uint32_t *event, void *entry, bool *cm_entry)
 Read one event without blocking (fi_eq_read()) into event and entry; cm_entry is set true for an fi_eq_cm_entry sized event and false for an fi_eq_entry sized one.
 
bool event_wait (uint32_t *event, void *entry, bool *cm_entry, int timeout=-1)
 Like event(), but blocks in fi_eq_sread() with the given timeout.
 
bool event_error (struct fi_eq_err_entry *entry)
 Zero entry and read one error entry into it (fi_eq_readerr()); returns true only if a full fi_eq_err_entry was read.
 
bool up () const
 Return true if the queue was opened and not shut down.
 
bool bind (Endpoint *ep)
 Bind this event queue to the fid_ep of ep; returns false on failure.
 
void shutdown ()
 Close the queue if it is up and mark it down.
 
- Public Member Functions inherited from Pds::Fabrics::ErrorHandler
 ErrorHandler ()
 Allocate the message buffer and start with no error (FI_SUCCESS and a message built from the text None).
 
virtual ~ErrorHandler ()
 Free the message buffer.
 
int error_num () const
 Return the last recorded error number (FI_SUCCESS if none).
 
const char * error () const
 Return the last recorded error message.
 
void clear_error ()
 Reset the error number to FI_SUCCESS and the message to the no-error text.
 

Protected Member Functions

bool handle_event (ssize_t event_ret, bool *cm_entry, const char *cmd)
 
bool initialize (struct fi_eq_attr *eq_attr, void *context)
 
- Protected Member Functions inherited from Pds::Fabrics::ErrorHandler
void set_custom_error (const char *fmt,...)
 
void set_error (const char *error_desc)
 

Protected Attributes

friend EndpointBase
 
friend Endpoint
 
- Protected Attributes inherited from Pds::Fabrics::ErrorHandler
int _errno
 
char * _error
 

Detailed Description

Wraps a libfabric event queue (fid_eq).

Constructor & Destructor Documentation

◆ EventQueue() [1/2]

Pds::Fabrics::EventQueue::EventQueue ( Fabric *  fabric,
size_t  size = 0 
)

Open an event queue of the given size with an unspecified wait object; up() reports success.

◆ EventQueue() [2/2]

Pds::Fabrics::EventQueue::EventQueue ( Fabric *  fabric,
struct fi_eq_attr *  eq_attr,
void *  context 
)

Open an event queue with caller-supplied attributes and context; up() reports success.

◆ ~EventQueue()

Pds::Fabrics::EventQueue::~EventQueue ( )

Close the queue if it is up.

Member Function Documentation

◆ bind()

bool Pds::Fabrics::EventQueue::bind ( Endpoint *  ep)

Bind this event queue to the fid_ep of ep; returns false on failure.

◆ eq()

struct fid_eq * Pds::Fabrics::EventQueue::eq ( ) const

Return the underlying fid_eq.

◆ event()

bool Pds::Fabrics::EventQueue::event ( uint32_t *  event,
void *  entry,
bool *  cm_entry 
)

Read one event without blocking (fi_eq_read()) into event and entry; cm_entry is set true for an fi_eq_cm_entry sized event and false for an fi_eq_entry sized one.

Returns false if nothing was read or on error (for -FI_EAVAIL the error number comes from the queued error entry).

◆ event_error()

bool Pds::Fabrics::EventQueue::event_error ( struct fi_eq_err_entry *  entry)

Zero entry and read one error entry into it (fi_eq_readerr()); returns true only if a full fi_eq_err_entry was read.

◆ event_wait()

bool Pds::Fabrics::EventQueue::event_wait ( uint32_t *  event,
void *  entry,
bool *  cm_entry,
int  timeout = -1 
)

Like event(), but blocks in fi_eq_sread() with the given timeout.

◆ handle_event()

bool Pds::Fabrics::EventQueue::handle_event ( ssize_t  event_ret,
bool *  cm_entry,
const char *  cmd 
)
protected

◆ initialize()

bool Pds::Fabrics::EventQueue::initialize ( struct fi_eq_attr *  eq_attr,
void *  context 
)
protected

◆ shutdown()

void Pds::Fabrics::EventQueue::shutdown ( )

Close the queue if it is up and mark it down.

◆ up()

bool Pds::Fabrics::EventQueue::up ( ) const

Return true if the queue was opened and not shut down.

Member Data Documentation

◆ Endpoint

friend Pds::Fabrics::EventQueue::Endpoint
protected

◆ EndpointBase

friend Pds::Fabrics::EventQueue::EndpointBase
protected

The documentation for this class was generated from the following file: