[+] Thread name identities
This commit is contained in:
parent
cb751d0286
commit
7038787001
@ -48,18 +48,19 @@ namespace Aurora::Threading::Threads
|
|||||||
virtual void SetThrottle(EThreadThrottle throttle) = 0;
|
virtual void SetThrottle(EThreadThrottle throttle) = 0;
|
||||||
virtual void SetAffinity(const HWInfo::CpuBitId &mask) = 0;
|
virtual void SetAffinity(const HWInfo::CpuBitId &mask) = 0;
|
||||||
virtual void SetName(const AuString &name) = 0;
|
virtual void SetName(const AuString &name) = 0;
|
||||||
|
virtual void SetNameIdentity(AuUInt32 uNameIdentity) = 0;
|
||||||
|
|
||||||
virtual EThreadPriority GetPriority() = 0;
|
virtual EThreadPriority GetPriority() = 0;
|
||||||
virtual EThreadThrottle GetThrottle() = 0;
|
virtual EThreadThrottle GetThrottle() = 0;
|
||||||
virtual HWInfo::CpuBitId GetMask() = 0;
|
virtual HWInfo::CpuBitId GetMask() = 0;
|
||||||
virtual AuString GetName() = 0;
|
virtual AuString GetName() = 0;
|
||||||
|
virtual AuUInt32 GetNameIdentity() = 0;
|
||||||
|
|
||||||
virtual AuUInt64 GetThreadCreationTime(Time::EClock eClock) = 0;
|
virtual AuUInt64 GetThreadCreationTime(Time::EClock eClock) = 0;
|
||||||
|
|
||||||
// TODO: will deprecate with a version that does call init on thread and deinit on deinit
|
// TODO: will deprecate with a version that does call init on thread and deinit on deinit
|
||||||
// ... just wait for it
|
/// Registers a thread feature _not_ calling on init [for now]
|
||||||
/// Registers a thread feature _not_ calling on init
|
/// It is not possible for this lower level thread object to schedule an init call (defer to async) [for now]
|
||||||
/// It is not possible for this lower level thread object to schedule an init call (defer to async)
|
|
||||||
/// Use this to register teardown functions
|
/// Use this to register teardown functions
|
||||||
virtual void AddLastHopeTlsHook(const AuSPtr<Threading::Threads::IThreadFeature> &feature) = 0;
|
virtual void AddLastHopeTlsHook(const AuSPtr<Threading::Threads::IThreadFeature> &feature) = 0;
|
||||||
|
|
||||||
|
@ -414,9 +414,15 @@ namespace Aurora::Threading::Threads
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->name_ = name;
|
this->name_ = name;
|
||||||
|
this->uNameIdentity_ = AuFnv1a32Runtime(name.data(), name.size());
|
||||||
this->UpdateName();
|
this->UpdateName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OSThread::SetNameIdentity(AuUInt32 uNameIdentity)
|
||||||
|
{
|
||||||
|
this->uNameIdentity_ = uNameIdentity;
|
||||||
|
}
|
||||||
|
|
||||||
EThreadThrottle OSThread::GetThrottle()
|
EThreadThrottle OSThread::GetThrottle()
|
||||||
{
|
{
|
||||||
return this->throttle_;
|
return this->throttle_;
|
||||||
@ -437,6 +443,11 @@ namespace Aurora::Threading::Threads
|
|||||||
return this->name_;
|
return this->name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AuUInt32 OSThread::GetNameIdentity()
|
||||||
|
{
|
||||||
|
return this->uNameIdentity_;
|
||||||
|
}
|
||||||
|
|
||||||
void OSThread::SetAffinity(const HWInfo::CpuBitId &mask)
|
void OSThread::SetAffinity(const HWInfo::CpuBitId &mask)
|
||||||
{
|
{
|
||||||
auto zero = HWInfo::CpuBitId();
|
auto zero = HWInfo::CpuBitId();
|
||||||
|
@ -31,11 +31,13 @@ namespace Aurora::Threading::Threads
|
|||||||
void SetThrottle(EThreadThrottle prio) override;
|
void SetThrottle(EThreadThrottle prio) override;
|
||||||
void SetAffinity(const HWInfo::CpuBitId &mask) override;
|
void SetAffinity(const HWInfo::CpuBitId &mask) override;
|
||||||
void SetName(const AuString &name) override;
|
void SetName(const AuString &name) override;
|
||||||
|
void SetNameIdentity(AuUInt32 uNameIdentity) override;
|
||||||
|
|
||||||
EThreadPriority GetPriority() override;
|
EThreadPriority GetPriority() override;
|
||||||
EThreadThrottle GetThrottle() override;
|
EThreadThrottle GetThrottle() override;
|
||||||
HWInfo::CpuBitId GetMask() override;
|
HWInfo::CpuBitId GetMask() override;
|
||||||
AuString GetName() override;
|
AuString GetName() override;
|
||||||
|
AuUInt32 GetNameIdentity() override;
|
||||||
|
|
||||||
void ExecuteInDeadThread(AuFunction<void()> callback) override;
|
void ExecuteInDeadThread(AuFunction<void()> callback) override;
|
||||||
AuSPtr<IWaitable> AsWaitable() override;
|
AuSPtr<IWaitable> AsWaitable() override;
|
||||||
@ -122,7 +124,7 @@ namespace Aurora::Threading::Threads
|
|||||||
|
|
||||||
AuUInt64 unixThreadId_ = 0;
|
AuUInt64 unixThreadId_ = 0;
|
||||||
bool detached_ {};
|
bool detached_ {};
|
||||||
|
AuUInt32 uNameIdentity_ {};
|
||||||
};
|
};
|
||||||
|
|
||||||
void InitThreading();
|
void InitThreading();
|
||||||
|
Loading…
Reference in New Issue
Block a user