1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use Deref;
use Arc;
use RawSemaphore;
/// RAII guard used to release access to the semaphore automatically when it falls out of scope.
///
/// Returned from `Semaphore::try_access`.
///
/// ## Sharing guards
///
/// There are cases where, once acquired, you want to share a guard between multiple threads
/// of execution. This pattern can be implemented by wrapping the acquired guard into an [`Rc`][1]
/// or [`Arc`][2] reference.
///
/// [1]: https://doc.rust-lang.org/std/rc/struct.Rc.html
/// [2]: https://doc.rust-lang.org/std/sync/struct.Arc.html