~sircmpwn/dowork#5: 
Race condition causing indefinite queue hangs

#Issue

If Queue::Shutdown() sends nil into q.shutdown before the goroutine in Queue::Start() creates the channel, the send will block indefinitely as q.shutdown would still be a nil channel.

#Reproduction

Running the following a few times should reproduce the issue.

package main

import (
	"context"
	"git.sr.ht/~sircmpwn/dowork"
)

func main() {
	task := work.NewTask(func(ctx context.Context) error {
		return nil
	})

	work.Enqueue(task)
	work.Shutdown()
}
Status
RESOLVED FIXED
Submitter
~satchmo
Assigned to
No-one
Submitted
3 years ago
Updated
3 years ago
Labels
No labels applied.