XRootD
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
reqTotaltotal number of requests
reqQuotanumber of requests to be run in parallel

Definition at line 44 of file XrdClRequestSync.hh.

44 :
45 pQuotaSem( new XrdSysSemaphore( reqQuota ) ),
46 pTotalSem( new XrdSysSemaphore( 0 ) ),
47 pRequestsLeft( reqTotal ),
48 pFailureCounter( 0 )
49 {
50 if( !reqTotal )
51 pTotalSem->Post();
52 }

◆ ~RequestSync()

XrdCl::RequestSync::~RequestSync ( )
inline

Destructor.

Definition at line 57 of file XrdClRequestSync.hh.

58 {
59 delete pQuotaSem;
60 delete pTotalSem;
61 }

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.

97 {
98 return pFailureCounter;
99 }

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.

83 {
84 XrdSysMutexHelper scopedLock( pMutex );
85 if( !success )
86 ++pFailureCounter;
87 --pRequestsLeft;
88 pQuotaSem->Post();
89 if( !pRequestsLeft )
90 pTotalSem->Post();
91 }

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.

75 {
76 pTotalSem->Wait();
77 }

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.

67 {
68 pQuotaSem->Wait();
69 }

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

Here is the caller graph for this function:

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