蓝黄同步,runningTid上移至CoTask

Signed-off-by: chendi <cdrom000@126.com>
Change-Id: Ib973736e507b13680f5c286b8f02c246f9a70e15
This commit is contained in:
chendi 2024-07-23 14:13:55 +08:00
parent 41d15b4e1c
commit ed1a47268c
4 changed files with 12 additions and 6 deletions

View File

@ -105,5 +105,12 @@ FFRT_C_API void ffrt_task_attr_set_local(ffrt_task_attr_t* attr, bool task_local
*/
FFRT_C_API bool ffrt_task_attr_get_local(ffrt_task_attr_t* attr);
FFRT_C_API pthread_t ffrt_task_get_tid(void* taskHandle);
/**
* @brief Obtains the thread id of the input task handle.
*
* @param task_handle The task pointer.
* @return The thread id of the input task handle.
* @version 1.0
*/
FFRT_C_API pthread_t ffrt_task_get_tid(void* task_handle);
#endif

View File

@ -601,14 +601,14 @@ bool ffrt_task_attr_get_local(ffrt_task_attr_t* attr)
}
API_ATTRIBUTE((visibility("default")))
pthread_t ffrt_task_get_tid(void* taskHandle)
pthread_t ffrt_task_get_tid(void* task_handle)
{
if (taskHandle == nullptr) {
if (task_handle == nullptr) {
FFRT_LOGE("invalid task handle");
return 0;
}
auto task = reinterpret_cast<ffrt::CPUEUTask*>(taskHandle);
auto task = reinterpret_cast<ffrt::CPUEUTask*>(task_handle);
return task->runningTid.load();
}
#ifdef __cplusplus

View File

@ -80,8 +80,6 @@ public:
void SetQos(QoS& newQos);
uint64_t reserved[8];
std::atomic<pthread_t> runningTid = 0;
void FreeMem() override;
void Execute() override;

View File

@ -51,6 +51,7 @@ public:
// |**********coroutine*********|
CoRoutine* coRoutine = nullptr;
uint64_t stack_size = STACK_SIZE;
std::atomic<pthread_t> runningTid = 0;
};
}
#endif