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

Waits on the wait file descriptors of several completion queues with poll(). More...

#include <Endpoint.hh>

Inherits Pds::Fabrics::ErrorHandler.

Public Member Functions

 CompletionPoller (Fabric *fabric, nfds_t size_hint=1)
 Allocate arrays for size_hint entries; up() is false if the fabric is not up.
 
 ~CompletionPoller ()
 Call shutdown() to free the arrays.
 
bool up () const
 Return true if initialization succeeded and shutdown() has not been called.
 
bool add (Endpoint *endp, CompletionQueue *cq)
 Add the wait fd of cq (from fi_control FI_GETWAIT) for endp, growing the arrays if needed; returns false if endp is already present or fi_control() fails.
 
bool del (Endpoint *endp)
 Remove the entry for endp; returns false if it is not present.
 
int poll (int timeout=-1)
 Call fi_trywait() on all queues and, if it succeeds, poll() their fds with timeout.
 
void shutdown ()
 Free the arrays if up() and mark the poller 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.
 

Additional Inherited Members

- Protected Member Functions inherited from Pds::Fabrics::ErrorHandler
void set_custom_error (const char *fmt,...)
 
void set_error (const char *error_desc)
 
- Protected Attributes inherited from Pds::Fabrics::ErrorHandler
int _errno
 
char * _error
 

Detailed Description

Waits on the wait file descriptors of several completion queues with poll().

Constructor & Destructor Documentation

◆ CompletionPoller()

Pds::Fabrics::CompletionPoller::CompletionPoller ( Fabric *  fabric,
nfds_t  size_hint = 1 
)

Allocate arrays for size_hint entries; up() is false if the fabric is not up.

◆ ~CompletionPoller()

Pds::Fabrics::CompletionPoller::~CompletionPoller ( )

Call shutdown() to free the arrays.

Member Function Documentation

◆ add()

bool Pds::Fabrics::CompletionPoller::add ( Endpoint *  endp,
CompletionQueue *  cq 
)

Add the wait fd of cq (from fi_control FI_GETWAIT) for endp, growing the arrays if needed; returns false if endp is already present or fi_control() fails.

◆ del()

bool Pds::Fabrics::CompletionPoller::del ( Endpoint *  endp)

Remove the entry for endp; returns false if it is not present.

◆ poll()

int Pds::Fabrics::CompletionPoller::poll ( int  timeout = -1)

Call fi_trywait() on all queues and, if it succeeds, poll() their fds with timeout.

Returns -FI_EAGAIN if fi_trywait() returns it, otherwise the poll() result or the fi_trywait() error.

◆ shutdown()

void Pds::Fabrics::CompletionPoller::shutdown ( )

Free the arrays if up() and mark the poller down.

◆ up()

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

Return true if initialization succeeded and shutdown() has not been called.


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