{"modulePath":"github.com/function61/edgerouter","version":"v0.0.0-20260305111458-5d50e7ec169e","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package syncutil\n\nTODO: move to gokit\n\n## Functions\n\n```go\nfunc Concurrently(\n\tctx context.Context,\n\tconcurrency int,\n\ttask func(ctx context.Context) error,\n\tworkSubmitter func(taskCtx context.Context) error,\n) error\n```\nconvenience wrapper around errgroup to run a simple task concurrently, and stop each worker if any of the tasks encounter an error during run\n\n## Types\n\n```go\ntype MutexMap struct {\n\t// contains filtered or unexported fields\n}\n```\nThink of this as an infinite number of named bathroom stalls. Each named stall can only be occupied by one person. When you TryLock(): a) it won't open if it's already occupied. (because it's locked inside) decide to do something else b) it opens and you get in and the stall gets reserved/locked for you. When you get out\n\n\tyou call the unlock callback you obtained from TryLock() to return the stall for use.\n\n```go\nfunc NewMutexMap() *MutexMap\n```\n\n```go\nfunc (n *MutexMap) Lock(key string) func()\n```\n\n```go\nfunc (n *MutexMap) TryLock(key string) (func(), bool)\n```\nreturns false if gate already open/reserved returns true if gate was opened for you. you have to use the returned func to release it\n\n","path":"github.com/function61/edgerouter/pkg/syncutil","name":"syncutil","synopsis":"TODO: move to gokit","isRedistributable":true}
