Sese Framework  x.y.z
A cross-platform framework
载入中...
搜索中...
未找到
sese::Thread类 参考final

线程类 更多...

#include <Thread.h>

类 sese::Thread 继承关系图:
sese::Noncopyable

struct  RuntimeData
 线程运行数据 更多...
 

Public 类型

using Ptr = std::unique_ptr<Thread>
 

Public 成员函数

 Thread (const std::function< void()> &function, const std::string &name=THREAD_DEFAULT_NAME)
 
 Thread (Thread &thread)
 
void start ()
 
void join ()
 
void detach ()
 
bool joinable () const
 
tid_t getTid () const noexcept
 
const std::string & getThreadName () const noexcept
 
- Public 成员函数 继承自 sese::Noncopyable
 Noncopyable ()=default
 
virtual ~Noncopyable ()=default
 
 Noncopyable (const Noncopyable &)=delete
 删除拷贝相关构造函数
 
Noncopyableoperator= (const Noncopyable &)=delete
 删除拷贝相关构造函数
 

静态 Public 成员函数

static void run (std::shared_ptr< RuntimeData > data)
 
static tid_t getCurrentThreadId () noexcept
 
static const char * getCurrentThreadName () noexcept
 
static void setCurrentThreadAsMain () noexcept
 
static tid_t getMainThreadId () noexcept
 
static Thread::RuntimeDatagetCurrentThreadData () noexcept
 

Private 属性

std::shared_ptr< RuntimeDatadata = nullptr
 

静态 Private 属性

static tid_t main_id = 0
 

详细描述

线程类

成员类型定义说明

◆ Ptr

using sese::Thread::Ptr = std::unique_ptr<Thread>

构造及析构函数说明

◆ Thread() [1/2]

sese::Thread::Thread ( const std::function< void()> & function,
const std::string & name = THREAD_DEFAULT_NAME )
explicit

引用了 data.

◆ Thread() [2/2]

sese::Thread::Thread ( Thread & thread)

引用了 data.

成员函数说明

◆ detach()

void sese::Thread::detach ( )

引用了 data.

◆ getCurrentThreadData()

Thread::RuntimeData * sese::Thread::getCurrentThreadData ( )
staticnoexcept

获取当前线程实例

返回
当前线程实例,当前线程为主线程时返回 nullptr

引用了 sese::current_data.

◆ getCurrentThreadId()

tid_t sese::Thread::getCurrentThreadId ( )
staticnoexcept

◆ getCurrentThreadName()

const char * sese::Thread::getCurrentThreadName ( )
staticnoexcept

◆ getMainThreadId()

tid_t sese::Thread::getMainThreadId ( )
staticnoexcept

引用了 main_id.

◆ getThreadName()

const std::string & sese::Thread::getThreadName ( ) const
inlinenodiscardnoexcept

◆ getTid()

tid_t sese::Thread::getTid ( ) const
inlinenodiscardnoexcept

◆ join()

void sese::Thread::join ( )

引用了 data.

被这些函数引用 sese::Timer::shutdown().

◆ joinable()

bool sese::Thread::joinable ( ) const
nodiscard

引用了 data.

◆ run()

void sese::Thread::run ( std::shared_ptr< RuntimeData > data)
static

◆ setCurrentThreadAsMain()

void sese::Thread::setCurrentThreadAsMain ( )
staticnoexcept

引用了 getTid() , 以及 main_id.

被这些函数引用 sese::ThreadInitiateTask::init().

◆ start()

void sese::Thread::start ( )

引用了 data , 以及 run().

类成员变量说明

◆ data

std::shared_ptr<RuntimeData> sese::Thread::data = nullptr
private

被这些函数引用 detach(), join(), joinable(), run(), start(), Thread() , 以及 Thread().

◆ main_id

tid_t sese::Thread::main_id = 0
staticprivate

该类的文档由以下文件生成: