{"id":21939197,"url":"https://github.com/grottopress/pond","last_synced_at":"2025-10-25T23:13:39.564Z","repository":{"id":63278756,"uuid":"351252364","full_name":"GrottoPress/pond","owner":"GrottoPress","description":"Crystal WaitGroups without channels or counters","archived":false,"fork":false,"pushed_at":"2024-04-16T16:04:36.000Z","size":30,"stargazers_count":25,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-17T07:06:49.337Z","etag":null,"topics":["concurrency","crystal","waitgroup"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/GrottoPress.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-03-24T23:33:23.000Z","updated_at":"2024-04-17T07:06:49.337Z","dependencies_parsed_at":"2024-04-16T01:25:49.504Z","dependency_job_id":"0621b48c-882c-434d-96c0-7c29e93cc6be","html_url":"https://github.com/GrottoPress/pond","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrottoPress%2Fpond","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrottoPress%2Fpond/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrottoPress%2Fpond/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrottoPress%2Fpond/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GrottoPress","download_url":"https://codeload.github.com/GrottoPress/pond/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227025005,"owners_count":17719205,"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":["concurrency","crystal","waitgroup"],"created_at":"2024-11-29T02:17:20.790Z","updated_at":"2025-10-25T23:13:39.503Z","avatar_url":"https://github.com/GrottoPress.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pond\n\n**Pond** is a *Crystal* implementation of a *WaitGroup*, without channels or explicit counters. *Pond* automatically keeps track of all its fibers, and waits until all of them complete execution.\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     pond:\n       github: GrottoPress/pond\n   ```\n\n1. Run `shards install`\n\n## Usage\n\n- Spawn fibers and wait on them:\n\n  ```crystal\n  require \"pond\"\n\n  pond = Pond.new\n\n  1000.times do |_|\n    pond.fill { do_work } # \u003c= Spawns fiber and passes block to it\n  end\n\n  pond.drain # \u003c= Waits for fibers to complete\n  ```\n\n  The code above is the same as:\n\n  ```crystal\n  require \"pond\"\n\n  Pond.drain do |pond|\n    1000.times do |_|\n      pond.fill { do_work }\n    end\n  end # \u003c= Drains pond automatically at the end of the block\n  ```\n\n- You may spawn *nested* fibers:\n\n  In this case, all *ancestor* fibers have to be added to the pond, otherwise *Pond* can't guarantee any of them would complete.\n\n  ```crystal\n  require \"pond\"\n\n  pond = Pond.new\n\n  pond.fill do\n    pond.fill do\n      pond.fill { do_work }\n    end\n  end\n\n  pond.drain\n  ```\n\n  Note that, while you can fill a pond that was created in a another fiber, draining has to be done in the same fiber the pond was created in. This is to prevent potential deadlocks.\n\n  ```crystal\n  require \"pond\"\n\n  pond = Pond.new\n\n  pond.fill { do_work }\n\n  spawn { pond.drain } # \u003c= Error!\n  ````\n\n## Development\n\nRun tests with `crystal spec -Dpreview_mt`. You may set `CRYSTAL_WORKERS` environment variable with `export CRYSTAL_WORKERS=\u003cnumber\u003e`, before running tests.\n\n## Contributing\n\n1. [Fork it](https://github.com/GrottoPress/pond/fork)\n1. Switch to the `master` branch: `git checkout master`\n1. Create your feature branch: `git checkout -b my-new-feature`\n1. Make your changes, updating changelog and documentation as appropriate.\n1. Commit your changes: `git commit`\n1. Push to the branch: `git push origin my-new-feature`\n1. Submit a new *Pull Request* against the `GrottoPress:master` branch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrottopress%2Fpond","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrottopress%2Fpond","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrottopress%2Fpond/lists"}