package stm import ( "context" "flag" "sync" ) var nFlag = flag.Int( "n", 1_000, "The number of iterations to execute", ) func MainTest() { flag.Parse() n := *nFlag var wg sync.WaitGroup wg.Add(n) lim := NewLimiter(Limit(n), n) ctx := context.Background() for i := 0; i < n; i++ { go func() { lim.WaitN(ctx, 1) wg.Done() }() } wg.Wait() }