Skip to content

[swift-inspect] Expose task completion flag #80184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/swift/RemoteInspection/ReflectionContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class ReflectionContext
bool HasIsRunning; // If false, the IsRunning flag is not valid.
bool IsRunning;
bool IsEnqueued;
bool IsComplete;

bool HasThreadPort;
uint32_t ThreadPort;
Expand Down Expand Up @@ -1779,6 +1780,7 @@ class ReflectionContext
TaskStatusFlags & ActiveTaskStatusFlags::IsStatusRecordLocked;
Info.IsEscalated = TaskStatusFlags & ActiveTaskStatusFlags::IsEscalated;
Info.IsEnqueued = TaskStatusFlags & ActiveTaskStatusFlags::IsEnqueued;
Info.IsComplete = TaskStatusFlags & ActiveTaskStatusFlags::IsComplete;

setIsRunning(Info, AsyncTaskObj.get());
std::tie(Info.HasThreadPort, Info.ThreadPort) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ fileprivate class ConcurrencyDumper {
var hasIsRunning: Bool
var isRunning: Bool
var isEnqueued: Bool
var isComplete: Bool
var threadPort: UInt32?
var id: UInt64
var runJob: swift_reflection_ptr_t
Expand Down Expand Up @@ -213,6 +214,7 @@ fileprivate class ConcurrencyDumper {
hasIsRunning: reflectionInfo.HasIsRunning,
isRunning: reflectionInfo.IsRunning,
isEnqueued: reflectionInfo.IsEnqueued,
isComplete: reflectionInfo.IsComplete,
threadPort: reflectionInfo.HasThreadPort
? reflectionInfo.ThreadPort
: nil,
Expand Down Expand Up @@ -275,6 +277,7 @@ fileprivate class ConcurrencyDumper {
if info.isEscalated { flags.append("escalated") }
if info.hasIsRunning && info.isRunning { flags.append("running") }
if info.isEnqueued { flags.append("enqueued") }
if info.isComplete { flags.append("complete") }

let flagsStr = flags.isEmpty ? "0" : flags.joined(separator: "|")
return flagsStr
Expand Down