Loading...
Searching...
No Matches
XrdCl::RequestSync Class Reference

A helper running a fixed number of requests at a given time. More...

`#include <XrdClRequestSync.hh>`

Collaboration diagram for XrdCl::RequestSync:

## Public Member Functions

| RequestSync (uint32_t reqTotal, uint32_t reqQuota)
| ~RequestSync ()
| Destructor.
uint32_t | FailureCount () const
| Number of tasks finishing with an error.
void | TaskDone (bool success=true)
| Report the request finish.
void | WaitForAll ()
| Wait for all the requests to be finished.
void | WaitForQuota ()
| Wait for the request quota.

## Detailed Description

A helper running a fixed number of requests at a given time.

Definition at line 35 of file XrdClRequestSync.hh.

## Constructor & Destructor Documentation

## RequestSync()

XrdCl::RequestSync::RequestSync | ( | uint32_t | reqTotal,
|  | uint32_t | reqQuota )

inline

Constructor

Parameters

  reqTotal | total number of requests
  reqQuota | number of requests to be run in parallel

Definition at line 44 of file XrdClRequestSync.hh.

:
pQuotaSem( new XrdSysSemaphore( reqQuota ) ),
pTotalSem( new XrdSysSemaphore( 0 ) ),
pRequestsLeft( reqTotal ),
pFailureCounter( 0 )
{
if( !reqTotal )
pTotalSem->Post();
}

## ~RequestSync()

XrdCl::RequestSync::~RequestSync | ( |  | ) |

inline

Destructor.

Definition at line 57 of file XrdClRequestSync.hh.

{
delete pQuotaSem;
delete pTotalSem;
}

## Member Function Documentation

## FailureCount()

uint32_t XrdCl::RequestSync::FailureCount | ( |  | ) | const

inline

Number of tasks finishing with an error.

Definition at line 96 of file XrdClRequestSync.hh.

{
return pFailureCounter;
}

Referenced by XrdCl::FileSystem::DirList().

Here is the caller graph for this function:

## TaskDone()

void XrdCl::RequestSync::TaskDone | ( | bool | success = true | ) |

inline

Report the request finish.

Definition at line 82 of file XrdClRequestSync.hh.

{
XrdSysMutexHelper scopedLock( pMutex );
if( !success )
++pFailureCounter;
--pRequestsLeft;
pQuotaSem->Post();
if( !pRequestsLeft )
pTotalSem->Post();
}

Referenced by XrdCl::FileSystem::DirList().

Here is the caller graph for this function:

## WaitForAll()

void XrdCl::RequestSync::WaitForAll | ( |  | ) |

inline

Wait for all the requests to be finished.

Definition at line 74 of file XrdClRequestSync.hh.

{
pTotalSem->Wait();
}

Referenced by XrdCl::FileSystem::DirList().

Here is the caller graph for this function:

## WaitForQuota()

void XrdCl::RequestSync::WaitForQuota | ( |  | ) |

inline

Wait for the request quota.

Definition at line 66 of file XrdClRequestSync.hh.

{
pQuotaSem->Wait();
}

Referenced by XrdCl::FileSystem::DirList().

Here is the caller graph for this function:

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

- XrdClRequestSync.hh