{"id":13413078,"url":"https://github.com/ivpusic/grpool","last_synced_at":"2025-06-28T04:03:47.174Z","repository":{"id":35217145,"uuid":"39476279","full_name":"ivpusic/grpool","owner":"ivpusic","description":"Lightweight Goroutine pool","archived":false,"fork":false,"pushed_at":"2019-01-27T23:07:22.000Z","size":20,"stargazers_count":741,"open_issues_count":5,"forks_count":101,"subscribers_count":31,"default_branch":"master","last_synced_at":"2024-07-31T20:51:54.252Z","etag":null,"topics":["golang","goroutine","pool","workers"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/ivpusic/grpool","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivpusic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-22T00:15:04.000Z","updated_at":"2024-07-09T09:49:07.000Z","dependencies_parsed_at":"2022-08-03T08:00:29.740Z","dependency_job_id":null,"html_url":"https://github.com/ivpusic/grpool","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ivpusic/grpool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivpusic%2Fgrpool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivpusic%2Fgrpool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivpusic%2Fgrpool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivpusic%2Fgrpool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivpusic","download_url":"https://codeload.github.com/ivpusic/grpool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivpusic%2Fgrpool/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262371664,"owners_count":23300593,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","goroutine","pool","workers"],"created_at":"2024-07-30T20:01:33.191Z","updated_at":"2025-06-28T04:03:47.135Z","avatar_url":"https://github.com/ivpusic.png","language":"Go","readme":"# grpool\n[![Build Status](https://travis-ci.org/ivpusic/grpool.svg?branch=master)](https://travis-ci.org/ivpusic/grpool)\n\nLightweight Goroutine pool\n\nClients can submit jobs. Dispatcher takes job, and sends it to first available worker.\nWhen worker is done with processing job, will be returned back to worker pool.\n\nNumber of workers and Job queue size is configurable.\n\n## Docs\nhttps://godoc.org/github.com/ivpusic/grpool\n\n## Installation\n```\ngo get github.com/ivpusic/grpool\n```\n\n## Simple example\n```Go\npackage main\n\nimport (\n  \"fmt\"\n  \"runtime\"\n  \"time\"\n\n  \"github.com/ivpusic/grpool\"\n)\n\nfunc main() {\n  // number of workers, and size of job queue\n  pool := grpool.NewPool(100, 50)\n\n  // release resources used by pool\n  defer pool.Release()\n\n  // submit one or more jobs to pool\n  for i := 0; i \u003c 10; i++ {\n    count := i\n\n    pool.JobQueue \u003c- func() {\n      fmt.Printf(\"I am worker! Number %d\\n\", count)\n    }\n  }\n\n  // dummy wait until jobs are finished\n  time.Sleep(1 * time.Second)\n}\n```\n\n## Example with waiting jobs to finish\n```Go\npackage main\n\nimport (\n  \"fmt\"\n  \"runtime\"\n\n  \"github.com/ivpusic/grpool\"\n)\n\nfunc main() {\n  // number of workers, and size of job queue\n  pool := grpool.NewPool(100, 50)\n  defer pool.Release()\n\n  // how many jobs we should wait\n  pool.WaitCount(10)\n\n  // submit one or more jobs to pool\n  for i := 0; i \u003c 10; i++ {\n    count := i\n\n    pool.JobQueue \u003c- func() {\n      // say that job is done, so we can know how many jobs are finished\n      defer pool.JobDone()\n\n      fmt.Printf(\"hello %d\\n\", count)\n    }\n  }\n\n  // wait until we call JobDone for all jobs\n  pool.WaitAll()\n}\n```\n\n## License\n*MIT*\n","funding_links":[],"categories":["Goroutines","\u003cspan id=\"协程-Coroutines\"\u003e协程 Coroutines\u003c/span\u003e","协程","協程","Goroutines `goroutines的管理和使用`","Relational Databases"],"sub_categories":["Advanced Console UIs","Search and Analytic Databases","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","检索及分析资料库","高级控制台界面","高級控制台界面","SQL 查询语句构建库"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivpusic%2Fgrpool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivpusic%2Fgrpool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivpusic%2Fgrpool/lists"}