Loading...
Searching...
No Matches
XrdOssCsiRanges Class Reference

`#include <XrdOssCsiRanges.hh>`

Collaboration diagram for XrdOssCsiRanges:

## Public Member Functions

| XrdOssCsiRanges ()
| ~XrdOssCsiRanges ()
void | AddRange (const off_t start, const off_t end, XrdOssCsiRangeGuard &rg, bool rdonly)
void | RemoveRange (XrdOssCsiRange_s *rp)
void | Wait (XrdOssCsiRange_s *rp)

## Detailed Description

Definition at line 100 of file XrdOssCsiRanges.hh.

## Constructor & Destructor Documentation

## XrdOssCsiRanges()

XrdOssCsiRanges::XrdOssCsiRanges | ( |  | ) |

inline

Definition at line 103 of file XrdOssCsiRanges.hh.

: allocList_(NULL) { }

## ~XrdOssCsiRanges()

XrdOssCsiRanges::~XrdOssCsiRanges | ( |  | ) |

inline

Definition at line 105 of file XrdOssCsiRanges.hh.

{
XrdOssCsiRange_s *p;
while((p = allocList_))
{
allocList_ = allocList_->next;
delete p;
}
}

## Member Function Documentation

## AddRange()

void XrdOssCsiRanges::AddRange | ( | const off_t | start,
|  | const off_t | end,
|  | XrdOssCsiRangeGuard & | rg,
|  | bool | rdonly )

inline

Definition at line 118 of file XrdOssCsiRanges.hh.

{
std::unique_lock<std::mutex> lck(rmtx_);
int nblocking = 0;
for(auto itr = ranges_.begin(); itr != ranges_.end(); ++itr)
{
if ((*itr)->start <= end && start <= (*itr)->end)
{
if (!(rdonly && (*itr)->rdonly))
{
nblocking++;
}
}
}
XrdOssCsiRange_s *nr = AllocRange();
nr->start = start;
nr->end = end;
nr->rdonly = rdonly;
nr->nBlockedBy = nblocking;
ranges_.push_back(nr);
lck.unlock();
rg.SetRange(this, nr);
}
XrdOssCsiRange_s::rdonly
bool rdonly
Definition XrdOssCsiRanges.hh:48
XrdOssCsiRange_s::nBlockedBy
int nBlockedBy
Definition XrdOssCsiRanges.hh:49
XrdOssCsiRange_s::start
off_t start
Definition XrdOssCsiRanges.hh:46
XrdOssCsiRange_s::end
off_t end
Definition XrdOssCsiRanges.hh:47
XrdOssCsiRangeGuard::SetRange
void SetRange(XrdOssCsiRanges *r, XrdOssCsiRange_s *rp)
Definition XrdOssCsiRanges.hh:63

References XrdOssCsiRange_s::end, XrdOssCsiRange_s::nBlockedBy, XrdOssCsiRange_s::rdonly, XrdOssCsiRangeGuard::SetRange(), and XrdOssCsiRange_s::start.

Here is the call graph for this function:

## RemoveRange()

void XrdOssCsiRanges::RemoveRange | ( | XrdOssCsiRange_s * | rp | ) |

inline

Definition at line 154 of file XrdOssCsiRanges.hh.

{
std::lock_guard<std::mutex> guard(rmtx_);
for(auto itr=ranges_.begin();itr!=ranges_.end();++itr)
{
if (*itr == rp)
{
ranges_.erase(itr);
break;
}
}
for(auto itr=ranges_.begin(); itr != ranges_.end(); ++itr)
{
if ((*itr)->start <= rp->end && rp->start <= (*itr)->end)
{
if (!(rp->rdonly && (*itr)->rdonly))
{
std::unique_lock<std::mutex> l((*itr)->mtx);
(*itr)->nBlockedBy--;
if ((*itr)->nBlockedBy == 0)
{
(*itr)->cv.notify_one();
}
}
}
}
RecycleRange(rp);
rp = NULL;
}

References XrdOssCsiRange_s::end, XrdOssCsiRange_s::rdonly, and XrdOssCsiRange_s::start.

## Wait()

void XrdOssCsiRanges::Wait | ( | XrdOssCsiRange_s * | rp | ) |

inline

Definition at line 145 of file XrdOssCsiRanges.hh.

{
std::unique_lock<std::mutex> l(rp->mtx);
while (rp->nBlockedBy>0)
{
rp->cv.wait(l);
}
}
XrdOssCsiRange_s::mtx
std::mutex mtx
Definition XrdOssCsiRanges.hh:50
XrdOssCsiRange_s::cv
std::condition_variable cv
Definition XrdOssCsiRanges.hh:51

References XrdOssCsiRange_s::cv, XrdOssCsiRange_s::mtx, and XrdOssCsiRange_s::nBlockedBy.

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

- XrdOssCsiRanges.hh