diff options
| author | hhvn <dev@hhvn.uk> | 2024-04-14 13:49:18 +0100 |
|---|---|---|
| committer | hhvn <dev@hhvn.uk> | 2024-04-14 13:49:18 +0100 |
| commit | 612e4fbeb14001d5eef0bb0e3e19ea65eb47cef2 (patch) | |
| tree | c000b5997dabcfe424af25b694a6c05356c03622 /status/02-cpu.go | |
| parent | 75a34eb4b035963970c8415316c2b2bd6a81eea6 (diff) | |
Tidy up the status block api a bit
Handle (nearly) all the plumbing (sleeps, goroutines and comms) in register()
Diffstat (limited to 'status/02-cpu.go')
| -rw-r--r-- | status/02-cpu.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/status/02-cpu.go b/status/02-cpu.go index f67d908..7128661 100644 --- a/status/02-cpu.go +++ b/status/02-cpu.go @@ -42,9 +42,7 @@ func getcpus(c chan [][]string, e chan error) { } } -func cpu(name string) error { - u := newUpdate(name) - +func cpu(u *Block) error { cpus := [2]chan [][]string{ make(chan [][]string), make(chan [][]string) } @@ -127,10 +125,10 @@ func cpu(name string) error { u.drawText(cx, blendGYR(int(cp)), fmt.Sprintf("%d°C", temps / ncores)) - updates <- u return nil } func init() { - register("cpu", cpu) + // 0 second interval, as there is already a 1 second sleep in cpu() + register("cpu", cpu, 0) } |