[*] Fix critical bug in rwlock (few commits ago. still havent updated submodules so its ok)

[*] IAsyncTransaction::uStartOffset should be u64
This commit is contained in:
Reece Wilson 2022-11-08 21:25:43 +00:00
parent e145352920
commit 673872f632
4 changed files with 21 additions and 23 deletions

View File

@ -30,13 +30,13 @@ namespace Aurora::IO
{
virtual bool SetFlushOnWrite(bool value) = 0;
virtual void ReserveBuffer(AuUInt length) = 0;
virtual void ReserveBuffer(AuUInt64 length) = 0;
virtual AuUInt GetReadOffset() = 0;
virtual AuUInt SetReadOffset(AuUInt offset) = 0;
virtual AuUInt64 GetReadOffset() = 0;
virtual AuUInt64 SetReadOffset(AuUInt64 offset) = 0;
virtual AuUInt GetWriteOffset() = 0;
virtual AuUInt SetWriteOffset(AuUInt offset) = 0;
virtual AuUInt64 GetWriteOffset() = 0;
virtual AuUInt64 SetWriteOffset(AuUInt64 offset) = 0;
virtual AuSPtr<IAsyncStreamReader> ToStreamReader() = 0;
virtual AuSPtr<IStreamWriter> ToStreamWriter() = 0;

View File

@ -14,7 +14,7 @@ namespace Aurora::IO
struct IOPipeRequestAIO : IOPipeRequest
{
AuSPtr<IAsyncTransaction> pAsyncTransaction;
AuUInt32 uStartOffset {};
AuUInt64 uStartOffset {};
IOPipeCallback output;
};

View File

@ -62,7 +62,7 @@ namespace Aurora::IO
{
AsyncStreamAdapter();
AuSPtr<AsyncStreamMemory> AllocateNextPageCached(AuUInt length);
AuSPtr<AsyncStreamMemory> AllocateNextPageCached(AuUInt64 length);
virtual AuSPtr<IAsyncStreamReader> ToStreamReader() override;
virtual AuSPtr<IStreamWriter> ToStreamWriter() override;
@ -78,17 +78,17 @@ namespace Aurora::IO
bool SetFlushOnWrite(bool value) override;
void ReserveBuffer(AuUInt length) override;
void ReserveBuffer(AuUInt64 length) override;
AuUInt GetReadOffset() override;
AuUInt SetReadOffset(AuUInt offset) override;
AuUInt64 GetReadOffset() override;
AuUInt64 SetReadOffset(AuUInt64 offset) override;
AuUInt GetWriteOffset() override;
AuUInt SetWriteOffset(AuUInt offset) override;
AuUInt64 GetWriteOffset() override;
AuUInt64 SetWriteOffset(AuUInt64 offset) override;
bool asyncActive {};
AuUInt readOffset {};
AuUInt writeOffset {};
AuUInt64 readOffset {};
AuUInt64 writeOffset {};
bool isStream {};
bool flushOnWrite {true};
@ -139,12 +139,12 @@ namespace Aurora::IO
return AuExchange(this->flushOnWrite, value);
}
AuUInt AsyncStreamAdapter::GetReadOffset()
AuUInt64 AsyncStreamAdapter::GetReadOffset()
{
return this->readOffset;
}
AuUInt AsyncStreamAdapter::SetReadOffset(AuUInt offset)
AuUInt64 AsyncStreamAdapter::SetReadOffset(AuUInt64 offset)
{
if (this->locked == 1)
{
@ -153,7 +153,7 @@ namespace Aurora::IO
return AuExchange(this->readOffset, offset);
}
AuUInt AsyncStreamAdapter::GetWriteOffset()
AuUInt64 AsyncStreamAdapter::GetWriteOffset()
{
if (this->locked == 1)
{
@ -162,7 +162,7 @@ namespace Aurora::IO
return this->writeOffset;
}
AuUInt AsyncStreamAdapter::SetWriteOffset(AuUInt offset)
AuUInt64 AsyncStreamAdapter::SetWriteOffset(AuUInt64 offset)
{
return AuExchange(this->writeOffset, offset);
}
@ -183,7 +183,7 @@ namespace Aurora::IO
}
AuSPtr<AsyncStreamMemory> AsyncStreamAdapter::AllocateNextPageCached(AuUInt length)
AuSPtr<AsyncStreamMemory> AsyncStreamAdapter::AllocateNextPageCached(AuUInt64 length)
{
if (this->lastAllocation)
{
@ -637,7 +637,7 @@ namespace Aurora::IO
return AuSPtr<IIOWaitableItem>(AuSharedFromThis(), &this->source);
}
void AsyncStreamAdapter::ReserveBuffer(AuUInt length)
void AsyncStreamAdapter::ReserveBuffer(AuUInt64 length)
{
if (!this->lastAllocation || !this->asyncActive)
{

View File

@ -132,8 +132,6 @@ namespace Aurora::Threading::Primitives
this->condition_->Broadcast();
continue;
}
return true;
}
}
}
@ -177,7 +175,7 @@ namespace Aurora::Threading::Primitives
return this->reentrantWriteLockHandle_ == AuThreads::GetThreadId();
}
return AuAtomicCompareExchange(&this->state_, iCurState + 1, iCurState) != iCurState;
return AuAtomicCompareExchange(&this->state_, iCurState + 1, iCurState) == iCurState;
}
bool RWLockImpl::TryLockWrite()