mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
Bugfix
This commit is contained in:
parent
5e14310071
commit
e551e2bc5d
12 changed files with 107 additions and 37 deletions
|
@ -7,15 +7,20 @@ class thread_ctrl_t final
|
|||
{
|
||||
friend class named_thread_t;
|
||||
|
||||
template<typename T> friend void current_thread_register_atexit(T);
|
||||
|
||||
// thread handler
|
||||
std::thread m_thread;
|
||||
|
||||
// name getter
|
||||
const std::function<std::string()> name;
|
||||
const std::function<std::string()> m_name;
|
||||
|
||||
// functions executed at thread exit (temporarily)
|
||||
std::vector<std::function<void()>> m_atexit;
|
||||
|
||||
public:
|
||||
thread_ctrl_t(std::function<std::string()> name)
|
||||
: name(std::move(name))
|
||||
: m_name(std::move(name))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -23,6 +28,14 @@ public:
|
|||
std::string get_name() const;
|
||||
};
|
||||
|
||||
// register function at thread exit (temporarily)
|
||||
template<typename T> void current_thread_register_atexit(T func)
|
||||
{
|
||||
extern thread_local thread_ctrl_t* g_tls_this_thread;
|
||||
|
||||
g_tls_this_thread->m_atexit.emplace_back(func);
|
||||
}
|
||||
|
||||
class named_thread_t
|
||||
{
|
||||
// pointer to managed resource (shared with actual thread)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue