{"id":28749044,"url":"https://github.com/kirillkh/monitor_rs","last_synced_at":"2025-06-16T19:34:22.186Z","repository":{"id":57640090,"uuid":"42355486","full_name":"kirillkh/monitor_rs","owner":"kirillkh","description":"Monitor: synchronization construct in Rust","archived":false,"fork":false,"pushed_at":"2016-07-03T12:44:14.000Z","size":12,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-05T04:12:44.928Z","etag":null,"topics":["monitor","multithreading","rust","synchronization"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kirillkh.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-12T11:57:55.000Z","updated_at":"2025-03-24T15:21:39.000Z","dependencies_parsed_at":"2022-09-07T13:50:17.661Z","dependency_job_id":null,"html_url":"https://github.com/kirillkh/monitor_rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kirillkh/monitor_rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillkh%2Fmonitor_rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillkh%2Fmonitor_rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillkh%2Fmonitor_rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillkh%2Fmonitor_rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kirillkh","download_url":"https://codeload.github.com/kirillkh/monitor_rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillkh%2Fmonitor_rs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260224310,"owners_count":22977375,"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":["monitor","multithreading","rust","synchronization"],"created_at":"2025-06-16T19:34:21.615Z","updated_at":"2025-06-16T19:34:22.171Z","avatar_url":"https://github.com/kirillkh.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## monitor_rs\nA convenience library that provides an easier way to use the combination of Mutex+Condvar in Rust. The concept is known as [Monitor synchronization construct](https://en.wikipedia.org/wiki/Monitor_%28synchronization%29) and is similar to Java's synchronized() statement.\n\nLicense: [MIT](https://github.com/kirillkh/monitor_rs/blob/master/legal/mit.md)\n\n### Usage\nPut this in your `Cargo.toml`:\n\n```toml\n[dependencies]\nmonitor = \"0.1.0\"\n```\n\nAnd this in your crate root:\n```rust\nextern crate monitor;\n```\n\n\n### Example\n```rust\nextern crate monitor;\n\nuse std::time::Duration;\nuse std::sync::Arc;\nuse std::thread;\nuse monitor::Monitor;\n\nfn main() {\n    let mon = Arc::new(Monitor::new(false));\n    {\n        let mon = mon.clone();\n        let _ = thread::spawn(move || {\n            thread::sleep(Duration::from_millis(1000));\n            \n            mon.with_lock(|mut done| {     // done is a monitor::MonitorGuard\u003cbool\u003e\n                *done = true;\n                done.notify_one();\n            });\n        });\n    }\n    \n    mon.with_lock(|mut done| {\n        while !*done {\n            done.wait();\n        }\n        println!(\"finished waiting\");\n    });\n}\n```\n\nFor more examples, see the tests in lib.rs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirillkh%2Fmonitor_rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirillkh%2Fmonitor_rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirillkh%2Fmonitor_rs/lists"}