fmsg: initialise dequeue prior to withhold/resume
test / test (push) Successful in 23s Details

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 Umiker 2024-10-27 01:24:30 +09:00
parent 2f34627d37
commit c7b77d6e5e
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q
1 changed files with 2 additions and 0 deletions

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{}{}
} }