{"id":17874605,"url":"https://github.com/shadowjonathan/exit-left","last_synced_at":"2025-04-03T00:14:07.581Z","repository":{"id":102139886,"uuid":"435183782","full_name":"ShadowJonathan/exit-left","owner":"ShadowJonathan","description":"A Rust synchronisation primitive for \"Multiplexed Concurrent Single-Threaded Read\" access","archived":false,"fork":false,"pushed_at":"2021-12-05T14:15:46.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T14:22:58.225Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"eupl-1.2","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ShadowJonathan.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-05T14:05:33.000Z","updated_at":"2021-12-05T14:15:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"81731ea1-755d-4916-8732-655b9aa74f26","html_url":"https://github.com/ShadowJonathan/exit-left","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadowJonathan%2Fexit-left","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadowJonathan%2Fexit-left/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadowJonathan%2Fexit-left/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadowJonathan%2Fexit-left/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShadowJonathan","download_url":"https://codeload.github.com/ShadowJonathan/exit-left/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246911467,"owners_count":20853657,"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":[],"created_at":"2024-10-28T11:09:48.022Z","updated_at":"2025-04-03T00:14:07.547Z","avatar_url":"https://github.com/ShadowJonathan.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `exit-left`\n\n\u003e *verb;*\n\u003e\n\u003e *1. To exit or disappear in a quiet, non-dramatic fashion, making way for more interesting events.*\n\u003e\n\u003e *2. (imperative) Leave the scene, and don't make a fuss.*\n\nA rust synchronization primitive that can allow multiplexing of an underlying resource.\n\nThe idea is as such; You have many threads, all of them want to \"wait\" for some event to come through the pipeline,\nbut the pipeline can give all kinds events in any order.\n\nWorse still, only one thread can poll/block on this resource, and could have to deal with the unwanted events before it gets the one it would want.\n\nThis crate's `Stage` struct is the solution, any thread \"heading\" it would be responsible for routing the events,\nbut it would be provided the tools to easily alert other threads waiting for \"it's own\" resource.\n\nIt does this via a `Hash + Eq` token type, which is passed to a `ticket` function, registering the token to be activated. Following this, the thread can then\ninvestigate the buffer, if it finds nothing, it can `enter` the stage, after which it will resume under one of the following three conditions;\n\n1. The thread is promoted to \"heading\" the stage, this can happen after the previous heading stage exits the stage, or if this thread is the first one to \"enter\" it.\n2. The thread passes a `timeout` parameter, and it passes by, the thread will then resume.\n3. A \"heading\" thread will notify this thread via its token, the thread will then resume.\n\n### Usage\n\nA potential usage would be to poll a `UdpSocket`, which can receive packets from multiple sources, but also send to multiple.\n\nUnlike a `TcpStream`, a `UdpSocket` has two potential modes, \"Connected\", or \"Not Connected\".\n\nThe former merely meaning that a filter is in place for a particular source, and all other packets are dropped.\n\nThus, normally, a `UdpSocket` in only \"Connected\" states would have to be constructed again and again for every local-remote tuple it would be used for,\nwith local ports becoming unaccessible to the rest of the system after its been `bind`-ed.\n\nSo, the `Stage` can help many threads to await a socket at the same time, while only one does the actual routing work,\nwhile still leaving the ability to notify threads waiting for \"their\" endpoint.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowjonathan%2Fexit-left","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshadowjonathan%2Fexit-left","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowjonathan%2Fexit-left/lists"}