獲取當前執行緒,執行緒id,設定優先順序等函式介面

2021-04-20 08:16:44 字數 2033 閱讀 5676

winbaseapi

handle

winapi

getcurrentthread(

void

);winbaseapi

dword

winapi

getcurrentthreadid(

void

);winbaseapi

dword

winapi

getprocessidofthread(

handle thread

);winbaseapi

dword

winapi

getthreadid(

handle thread

);winbaseapi

dword

winapi

getprocessid(

handle process

);winbaseapi

dword

winapi

getcurrentprocessornumber(

void

);winbaseapi

dword_ptr

winapi

setthreadaffinitymask(

in handle hthread,

in dword_ptr dwthreadaffinitymask

);#if(_win32_winnt >= 0x0400)

winbaseapi

dword

winapi

setthreadidealprocessor(

in handle hthread,

in dword dwidealprocessor

);#endif /* _win32_winnt >= 0x0400 */

winbaseapi

bool

winapi

setprocesspriorityboost(

in handle hprocess,

in bool bdisablepriorityboost

);winbaseapi

bool

winapi

getprocesspriorityboost(

in handle hprocess,

out pbool pdisablepriorityboost

);winbaseapi

bool

winapi

requestwakeuplatency(

in latency_time latency

);winbaseapi

bool

winapi

issystemresumeautomatic(

void

);winbaseapi

handle

winapi

openthread(

dword dwdesiredaccess,

bool binherithandle,

dword dwthreadid

);winbaseapi

bool

winapi

setthreadpriority(

in handle hthread,

in int npriority

);winbaseapi

bool

winapi

setthreadpriorityboost(

in handle hthread,

in bool bdisablepriorityboost

);winbaseapi

bool

winapi

getthreadpriorityboost(

in handle hthread,

out pbool pdisablepriorityboost

);winbaseapi

intwinapi

getthreadpriority(

in handle hthread

);

c 獲取執行緒id 高效獲取當前執行緒的 id

可以利用微軟提供的 api,輕鬆獲取當前執行緒的 id int id getcurrentthreadid linux 平台一般用的是 pthread 執行緒庫,但它並不提供獲取執行緒內部 id 的方法。可以通過系統呼叫得到當前執行緒的 id include for syscall include ...

5 獲取和設定執行緒優先順序

獲取和設定執行緒優先順序 優先順序對執行緒至關重要。cpu優先執行優先順序高的執行緒。下面我們將來介紹 1.如何獲取執行緒的優先順序 2.如何設定執行緒的優先順序?首先介紹的是如何獲取執行緒的優先順序,通過thread類的getpriority方法,就可以獲取到執行緒的優先順序。它返回的是乙個int...

執行緒優先順序的設定

執行緒的優先順序 1 10,10為最高端別,1為最低級別,5為預設級別 thread.min priority 最小優先順序 thread.max priority 最高優先順序 thread.norm priority 預設優先順序 設定優先順序 public class jointhread2 ...