diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2017-03-08 08:22:31 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2017-03-08 08:22:31 -0500 |
| commit | 388c34cc9ff92f94e51d3ea0deb00aaa0564a6b3 (patch) | |
| tree | 4bfa71b03f8c5951c335106470ceda9aa37a9392 | |
| parent | d88a15fb2572419dbf80b1c30b3d29b312367813 (diff) | |
Resource::new is also unsafe
| -rw-r--r-- | src/lib.rs | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -48,7 +48,9 @@ impl<T> ResourceP<T> { /// /// # Unsafety /// - /// - Do not create two resources that point to the same peripheral + /// - Must not create two resources that point to the same peripheral + /// - The `ceiling` must be picked to prevent two or more concurrent tasks + /// from claiming this resource (preemptively) pub const unsafe fn new(p: Peripheral<T>, ceiling: u8) -> Self { ResourceP { peripheral: p, @@ -84,7 +86,12 @@ impl<T> Resource<T> { /// Initializes a resource /// /// NOTE `ceiling` must be in the range `[1, 15]` - pub const fn new(data: T, ceiling: u8) -> Self { + /// + /// # Unsafety + /// + /// - The `ceiling` must be picked to prevent two or more concurrent tasks + /// from claiming this resource (preemptively) + pub const unsafe fn new(data: T, ceiling: u8) -> Self { Resource { // NOTE elements 1 and 2 of the tuple are a poor man's const context // range checker |
