mirror of
https://gitee.com/openharmony/resourceschedule_ffrt
synced 2025-03-01 02:07:16 +00:00
!491 Modify warnings of type conversion.
Merge pull request !491 from 梅志坚/master_2024_10_30
This commit is contained in:
commit
a4e86ce6fd
@ -3852,7 +3852,7 @@ void fib_ffrt(int x, int* y)
|
||||
|
||||
## FFRT对使用fork()场景的支持说明
|
||||
|
||||
* 在未使用FFRT的进程中,创建子进程,支持在该子进程中使用FFRT(调用submit,timer,epoll等任务类操作)。
|
||||
* 在未使用FFRT的进程中,创建子进程,支持在该子进程中使用FFRT。
|
||||
* 在已经使用FFRT的进程中,以fork()(无exec())方式创建子进程,不支持在该子进程中使用FFRT。
|
||||
* 在已经使用FFRT的进程中,以fork()+exec()方式创建子进程,支持在子进程中使用FFRT。
|
||||
|
||||
|
@ -34,19 +34,19 @@ void RecordMutex::LoadInfo()
|
||||
owner_.id = ExecuteCtx::Cur()->task->gid;
|
||||
owner_.type = MutexOwnerType::MUTEX_OWNER_TYPE_TASK;
|
||||
} else {
|
||||
owner_.id = gettid();
|
||||
owner_.id = static_cast<uint64_t>(gettid());
|
||||
owner_.type = MutexOwnerType::MUTEX_OWNER_TYPE_THREAD;
|
||||
}
|
||||
|
||||
owner_.timestamp = std::chrono::steady_clock::now();
|
||||
owner_.timestamp = static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now().time_since_epoch()).count());
|
||||
}
|
||||
|
||||
uint64_t RecordMutex::GetDuration()
|
||||
{
|
||||
uint64_t now = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now().time_since_epoch()).count();
|
||||
uint64_t past = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
owner_.timestamp.time_since_epoch()).count();
|
||||
uint64_t now = static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now().time_since_epoch()).count());
|
||||
uint64_t past = owner_.timestamp;
|
||||
return (now > past) ? now - past : 0;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ enum class MutexOwnerType {
|
||||
struct MutexOwner {
|
||||
uint64_t id; // 持锁task的id或者持锁线程的id
|
||||
MutexOwnerType type;
|
||||
std::chrono::steady_clock::time_point timestamp;
|
||||
uint64_t timestamp;
|
||||
};
|
||||
|
||||
class RecordMutex {
|
||||
@ -53,19 +53,19 @@ public:
|
||||
return &mutex_;
|
||||
}
|
||||
|
||||
bool HasLock()
|
||||
bool HasLock() const
|
||||
{
|
||||
return owner_.id != 0;
|
||||
}
|
||||
|
||||
bool IsTimeout();
|
||||
|
||||
uint64_t GetOwnerId()
|
||||
uint64_t GetOwnerId() const
|
||||
{
|
||||
return owner_.id;
|
||||
}
|
||||
|
||||
MutexOwnerType GetOwnerType()
|
||||
MutexOwnerType GetOwnerType() const
|
||||
{
|
||||
return owner_.type;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user