Skip to content

Commit a5ab9b4

Browse files
author
unbalancedparentheses
committed
complete thread gen server
1 parent 1299da8 commit a5ab9b4

File tree

4 files changed

+301
-50
lines changed

4 files changed

+301
-50
lines changed

concurrency/src/supervisor.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,9 +1125,6 @@ struct DynamicChildInfo {
11251125
/// The child's current handle.
11261126
handle: BoxedChildHandle,
11271127

1128-
/// Monitor reference for this child.
1129-
monitor_ref: Option<MonitorRef>,
1130-
11311128
/// Number of restarts for this child.
11321129
restart_count: u32,
11331130
}
@@ -1162,13 +1159,12 @@ impl DynamicSupervisorState {
11621159
let handle = spec.start();
11631160
let pid = handle.pid();
11641161

1165-
// Set up monitoring
1166-
let monitor_ref = supervisor_handle.monitor(&ChildPidWrapper(pid)).ok();
1162+
// Set up monitoring (we don't store the ref as we track children by pid)
1163+
let _ = supervisor_handle.monitor(&ChildPidWrapper(pid));
11671164

11681165
let info = DynamicChildInfo {
11691166
spec,
11701167
handle,
1171-
monitor_ref,
11721168
restart_count: 0,
11731169
};
11741170

@@ -1221,12 +1217,11 @@ impl DynamicSupervisorState {
12211217
// Restart the child
12221218
let new_handle = info.spec.start();
12231219
let new_pid = new_handle.pid();
1224-
let monitor_ref = supervisor_handle.monitor(&ChildPidWrapper(new_pid)).ok();
1220+
let _ = supervisor_handle.monitor(&ChildPidWrapper(new_pid));
12251221

12261222
let new_info = DynamicChildInfo {
12271223
spec: info.spec,
12281224
handle: new_handle,
1229-
monitor_ref,
12301225
restart_count: info.restart_count + 1,
12311226
};
12321227

@@ -1621,19 +1616,25 @@ mod integration_tests {
16211616
id: String,
16221617
}
16231618

1619+
// These enums are defined for completeness and to allow future tests to exercise
1620+
// worker call/cast paths. Currently, tests operate through the Supervisor API
1621+
// and don't have direct access to child handles.
16241622
#[derive(Clone, Debug)]
1623+
#[allow(dead_code)]
16251624
enum WorkerCall {
16261625
GetStartCount,
16271626
GetId,
16281627
}
16291628

16301629
#[derive(Clone, Debug)]
1630+
#[allow(dead_code)]
16311631
enum WorkerCast {
16321632
Crash,
16331633
ExitNormal,
16341634
}
16351635

16361636
#[derive(Clone, Debug)]
1637+
#[allow(dead_code)]
16371638
enum WorkerResponse {
16381639
StartCount(u32),
16391640
Id(String),

0 commit comments

Comments
 (0)