Skip to content

Commit

Permalink
[davix] Restrict lock in TDavixFile::ReadBuffer
Browse files Browse the repository at this point in the history
Restrict lock in `TDavixFile::ReadBuffer` to only be avoid the
`d_ptr->davixPosix->pread()` call by moving the lock into the private
helper function. That also means that the lock is now used in all the
`ReadBuffer` overloads.
  • Loading branch information
guitargeek committed Feb 5, 2025
1 parent d032ff8 commit 89668bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions net/davix/src/TDavixFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,6 @@ void TDavixFile::Seek(Long64_t offset, ERelativeTo pos)

Bool_t TDavixFile::ReadBuffer(char *buf, Int_t len)
{
TLockGuard guard(&davixLock);
Davix_fd *fd;
if ((fd = d_ptr->getDavixFileInstance()) == NULL)
return kTRUE;
Expand Down Expand Up @@ -912,7 +911,12 @@ Long64_t TDavixFile::DavixReadBuffer(Davix_fd *fd, char *buf, Long64_t pos, Int_
DavixError *davixErr = NULL;
Double_t start_time = eventStart();

Long64_t ret = d_ptr->davixPosix->pread(fd, buf, len, pos, &davixErr);
Long64_t ret;
{
TLockGuard guard(&davixLock);
ret = d_ptr->davixPosix->pread(fd, buf, len, pos, &davixErr);
}

if (ret < 0) {
Error("DavixReadBuffer", "can not read data with davix: %s (%d)",
davixErr->getErrMsg().c_str(), davixErr->getStatus());
Expand Down

0 comments on commit 89668bb

Please sign in to comment.