[*] Qt: More LoopQueue NT fun
This commit is contained in:
parent
6e035195f7
commit
5dddc9d0d8
@ -203,6 +203,11 @@ namespace Aurora::IO::Loop
|
||||
that->Sync();
|
||||
}
|
||||
|
||||
bool TryLock()
|
||||
{
|
||||
return that->Sync2();
|
||||
}
|
||||
|
||||
void Unlock()
|
||||
{
|
||||
that->Unlock();
|
||||
@ -224,6 +229,25 @@ namespace Aurora::IO::Loop
|
||||
::ResetEvent(this->hEvent_);
|
||||
}
|
||||
|
||||
bool LoopQueue::Sync2()
|
||||
{
|
||||
if (this->hEvent_ != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
::SetEvent(this->hEvent_);
|
||||
}
|
||||
|
||||
if (!this->rwMutex_->AsWritable()->TryLock())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this->hEvent_ != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
::ResetEvent(this->hEvent_);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void LoopQueue::Unlock()
|
||||
{
|
||||
this->rwMutex_->AsWritable()->Unlock();
|
||||
@ -317,7 +341,7 @@ namespace Aurora::IO::Loop
|
||||
}
|
||||
|
||||
LoopJoinable joinable {this};
|
||||
AU_LOCK_GUARD(joinable);
|
||||
AU_TRY_LOCK_GUARD_RET_DEF(joinable);
|
||||
|
||||
return CommitLocked();
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ namespace Aurora::IO::Loop
|
||||
AuList<AuSPtr<ILoopSource>> WaitAnyEx(AuUInt32 timeout) override;
|
||||
|
||||
void Sync();
|
||||
bool Sync2();
|
||||
void Unlock();
|
||||
bool bCheckForDups {};
|
||||
bool bCheckForForce {};
|
||||
|
Loading…
Reference in New Issue
Block a user