{"id":27858427,"url":"https://github.com/roboplc/rtsc","last_synced_at":"2025-05-04T14:09:59.849Z","repository":{"id":244564107,"uuid":"815634946","full_name":"roboplc/rtsc","owner":"roboplc","description":"Real-time Synchronization Components for Rust","archived":false,"fork":false,"pushed_at":"2025-05-02T22:06:14.000Z","size":87,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-04T14:09:54.592Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.bohemia-automation.com/software/libraries/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roboplc.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,"zenodo":null}},"created_at":"2024-06-15T17:14:06.000Z","updated_at":"2025-05-02T22:06:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"27b01854-95d7-4705-a918-1a1bb0b974aa","html_url":"https://github.com/roboplc/rtsc","commit_stats":null,"previous_names":["roboplc/rtsc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboplc%2Frtsc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboplc%2Frtsc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboplc%2Frtsc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboplc%2Frtsc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roboplc","download_url":"https://codeload.github.com/roboplc/rtsc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252344577,"owners_count":21732981,"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":"2025-05-04T14:09:59.282Z","updated_at":"2025-05-04T14:09:59.842Z","avatar_url":"https://github.com/roboplc.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch2\u003e\n  RTSC - Real-time Synchronization Components\n  \u003ca href=\"https://crates.io/crates/rtsc\"\u003e\u003cimg alt=\"crates.io page\" src=\"https://img.shields.io/crates/v/rtsc.svg\"\u003e\u003c/img\u003e\u003c/a\u003e\n  \u003ca href=\"https://docs.rs/rtsc\"\u003e\u003cimg alt=\"docs.rs page\" src=\"https://docs.rs/rtsc/badge.svg\"\u003e\u003c/img\u003e\u003c/a\u003e\n\u003c/h2\u003e\n\nRequirements for data synchronization in real-time applications differ from\ntraditional high-load ones. The main difference is that real-time\nsynchronization components must carefully respect and follow the traditional\noperating-system approach, avoid user-space spin-loops and other busy-waiting\ntechniques (see [Channels in Rust. Part\n2](https://medium.com/@disserman/channels-in-rust-part-2-603721567ee6) where\nsuch problems are clearly described).\n\n## Components\n\nThis crate provides a pack of real-time-safe synchronization components for\nvarious typical and custom use-cases.\n\n* Data Buffer\n* Synchronization cells\n* Sync/async channels\n* Policy-based channels\n* Semaphore\n* Time tools\n\n## Locking policy\n\nAll the components support both the default and custom locking policies, mean\nMutex and Condvar implementations can be replaced with 3rd party ones for each\ncomponent instance used.\n\nThis allows to use RTSC components in various environments, e.g.:\n\n* For standard real-time: use\n  [parking_lot_rt](https://crates.io/crates/parking_lot_rt) (default for all\n  systems except Linux).\n\n* For safety-critical real-time use the provided [`pi`] components which\n  support priority inheritance (default for Linux, works on Linux only,\n  recommended Kernel 5.14+).\n\n* For latency-critical real-time use spin-based locks.\n\n* For high-load non-real-time use\n  [parking_lot](https://crates.io/crates/parking_lot) components.\n\n### The default locking policy\n\n```rust\n// For the implicit \u003cT\u003e\nlet (tx, rx) = rtsc::channel_bounded!(10);\ntx.send(42).unwrap();\n\n// For the explicit \u003cT\u003e\nuse rtsc::channel;\n\n// The `Bounded` structure is used as a workaround to specify the default\n// Mutex/Condvar, being destructuring to the sender and the receiver.\nlet channel::Bounded { tx, rx } = channel::Bounded::\u003ci32\u003e::new(10);\n```\n\nOn Linux the crate uses built-in priority-inheritance [`pi::Mutex`]\nimplementation and re-exports this module as `locking`.\n\nOn other platforms, all components use Mutex/Condvar synchronization primitives\nfrom [parking_lot_rt](https://crates.io/crates/parking_lot_rt) - a real-time\nfork of the well-known [parking_lot](https://crates.io/crates/parking_lot)\ncrate. This is a relatively safe Mutex/RwLock with minimal user-space\nspin-waiting. The module is re-exported as [`locking`] as well.\n\n### Custom locking policy\n\nThe crate components provide API to specify 3rd party Mutex/Condvar\nimplementation.\n\n```rust\n// Forcibly use the parking_lot_rt Mutex/Condvar\nlet (tx, rx) = rtsc::channel::bounded::\u003ci32,\n    parking_lot_rt::RawMutex, parking_lot_rt::Condvar\u003e(1);\n```\n\nNote: asynchronous channels use `parking_lot_rt` locking only.\n\n#### Supported mutexes\n\nAll mutexes, which implement `locking_api::RawMutex` trait from the\n[lock_api](https://crates.io/crates/lock_api) crate.\n\n#### Supported condition variables\n\nFor the condition variables, the trait [`condvar_api::RawCondvar`] must\nbe implemented.\n\nThe trait is automatically implemented for:\n\n* The Built-in locks provided\n\n* `parking_lot::Condvar` (requires `parking_lot` feature)\n\n## References\n\nRTSC is a part of [RoboPLC](https://www.roboplc.com) project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froboplc%2Frtsc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froboplc%2Frtsc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froboplc%2Frtsc/lists"}