Commit b9cc4ca
fix(sysmon): guard Monitor sampling with a mutex for the race detector
The TUI shares a single *sysmon.Monitor across bubbletea's value-copied
Model and samples it from tick-driven Update handling, so the CPU-rate
state (prevCPUUsec/prevAt/havePrev) was read and written from more than
one goroutine over the program's lifetime. `go test -race` flagged it in
the new CI race job. Serialize Sample() with a mutex.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 4bfbb6a commit b9cc4ca
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
45 | 51 | | |
46 | 52 | | |
47 | 53 | | |
| |||
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
| 70 | + | |
| 71 | + | |
64 | 72 | | |
65 | 73 | | |
66 | 74 | | |
| |||
0 commit comments