fmsg: initialise dequeue prior to withhold/resume
All checks were successful
test / test (push) Successful in 23s

This fixes the hang on resume when no messages were ever printed.

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
Ophestra 2024-10-27 01:24:30 +09:00
parent 2f34627d37
commit c7b77d6e5e
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q

View File

@ -37,12 +37,14 @@ func Exit(code int) {
} }
func Withhold() { func Withhold() {
dequeueOnce.Do(dequeue)
if wstate.CompareAndSwap(false, true) { if wstate.CompareAndSwap(false, true) {
withhold <- struct{}{} withhold <- struct{}{}
} }
} }
func Resume() { func Resume() {
dequeueOnce.Do(dequeue)
if wstate.CompareAndSwap(true, false) { if wstate.CompareAndSwap(true, false) {
withhold <- struct{}{} withhold <- struct{}{}
} }