Reece Wilson
8ff81df129
[*] Optimize mutex lock out of RWLockImpl::TryLockWrite [*] Force all relevant members of RWLockImpl to be volatile just bc lol (afaik we cant justify it yet; however, i want to minimalize the risk of future issues in this type)
55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: ThreadState.hpp
|
|
Date: 2021-11-1
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
#include "AsyncRunnable.hpp"
|
|
|
|
namespace Aurora::Async
|
|
{
|
|
using WorkEntry_t = AuPair<ThreadId_t, AuSPtr<IAsyncRunnable>>;
|
|
|
|
// TODO: this is a hack because i havent implemented an epoll abstraction yet
|
|
struct AsyncAppWaitSourceRequest
|
|
{
|
|
AuConsumer<AuSPtr<AuLoop::ILoopSource>, bool> callback;
|
|
AuSPtr<AuLoop::ILoopSource> loopSource;
|
|
AuUInt32 requestedOffset;
|
|
AuUInt64 startTime;
|
|
AuUInt64 endTime;
|
|
};
|
|
|
|
struct GroupState;
|
|
struct AsyncLoop;
|
|
|
|
struct ThreadState
|
|
{
|
|
WorkerId_t id;
|
|
AuUInt8 multipopCount = 1;
|
|
AuUInt32 lastFrameTime {};
|
|
AuThreads::ThreadShared_t threadObject;
|
|
AuWPtr<GroupState> parent;
|
|
AuThreadPrimitives::SemaphoreUnique_t syncSema;
|
|
AuList<AuSPtr<AuThreads::IThreadFeature>> features;
|
|
bool rejecting {};
|
|
bool exiting {};
|
|
bool shuttingdown {};
|
|
bool exitingflag2 {};
|
|
AuThreadPrimitives::EventUnique_t running;
|
|
//bool running;
|
|
AuList<AsyncAppWaitSourceRequest> loopSources;
|
|
AuList<WorkEntry_t> pendingWorkItems;
|
|
AuSPtr<AsyncLoop> asyncLoop;
|
|
Utility::RateLimiter rateLimiter;
|
|
ERunMode runMode;
|
|
int cookie {0};
|
|
|
|
//
|
|
AuThreadPrimitives::SpinLock externalFencesLock;
|
|
AuList<AuThreading::IWaitable *> externalFences;
|
|
};
|
|
} |