go get -u github.com/jackal-xmpp/runqueue/v2
The runqueue
package allows to enqueue and run functions in serial order ensuring exclusive access.
package main
import (
"fmt"
"log"
"github.com/jackal-xmpp/runqueue/v2"
)
func main() {
rq := runqueue.New("rq-1", log.Printf)
var counter int32
for i := 0; i < 2500; i++ {
rq.Run(func() { counter++ })
}
fmt.Println(counter)
}
Expected output:
2500
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request