Skip to content

Commit

Permalink
AdapterIO: Fix problem with RWLocker
Browse files Browse the repository at this point in the history
* Originally this code didn't use an AutoLocker, when I changed it
I didn't realize I created an anonymous temporary inadvertently.
* Thanks to hamishm for catching this.
  • Loading branch information
Numerio committed Jun 2, 2016
1 parent 4c7eafb commit be67b10
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/kits/media/AdapterIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ BAdapterIO::ReadAt(off_t position, void* buffer, size_t size)
{
printf("read at %d %d \n", (int)position, (int)size);
_WaitForData(position+size);
AutoReadLocker(fLock);
AutoReadLocker _(fLock);

return fBuffer->ReadAt(position, buffer, size);
}
Expand All @@ -58,7 +58,7 @@ ssize_t
BAdapterIO::WriteAt(off_t position, const void* buffer, size_t size)
{
_WaitForData(position+size);
AutoWriteLocker(fLock);
AutoWriteLocker _(fLock);

return fBuffer->WriteAt(position, buffer, size);
}
Expand All @@ -68,7 +68,7 @@ off_t
BAdapterIO::Seek(off_t position, uint32 seekMode)
{
_WaitForData(position);
AutoWriteLocker(fLock);
AutoWriteLocker _(fLock);

return fBuffer->Seek(position, seekMode);
}
Expand All @@ -77,7 +77,7 @@ BAdapterIO::Seek(off_t position, uint32 seekMode)
off_t
BAdapterIO::Position() const
{
AutoReadLocker(fLock);
AutoReadLocker _(fLock);

return fBuffer->Position();
}
Expand All @@ -86,7 +86,7 @@ BAdapterIO::Position() const
status_t
BAdapterIO::SetSize(off_t size)
{
AutoWriteLocker(fLock);
AutoWriteLocker _(fLock);

return fBuffer->SetSize(size);
}
Expand All @@ -95,7 +95,7 @@ BAdapterIO::SetSize(off_t size)
status_t
BAdapterIO::GetSize(off_t* size) const
{
AutoReadLocker(fLock);
AutoReadLocker _(fLock);

return fBuffer->GetSize(size);
}
Expand All @@ -115,7 +115,7 @@ BAdapterIO::BuildInputAdapter()
ssize_t
BAdapterIO::BackWrite(const void* buffer, size_t size)
{
AutoWriteLocker(fLock);
AutoWriteLocker _(fLock);

off_t currentPos = Position();
off_t ret = fBuffer->WriteAt(fBackPosition, buffer, size);
Expand Down

0 comments on commit be67b10

Please sign in to comment.