This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strings" | |
"testing" | |
) | |
// generateArgs generates args (100) | |
func generateArgs() []string { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// multiple producers, multiple consumers | |
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
// producers sends the value to the channel | |
func producers(id int, ch chan<- int, wg *sync.WaitGroup) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
type Cache[K comparable, V any] struct { | |
data map[K]item[V] |