Skip to content

vyacheslavhere/svetofor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿšฆ svetofor

... is simple semaphore implementation in Rust using parking_lot

๐Ÿ“ฆ Installation

Add this to your Cargo.toml:

[dependencies]
svetofor = "0.1.1"

๐Ÿ Getting started

use svetofor::Semaphore;

fn main() {
  // creating new semaphore
  let sem = Semaphore::new(1);

  // acquiring guard
  let guard = sem.acquire();

  // while guard alive, counter must be 0
  assert_eq!(sem.counter(), 0);

  // dropping guard
  drop(guard);

  // after guard drop, counter must be 1
  assert_eq!(sem.counter(), 1);
}

About

๐Ÿšฆ Semaphore implementation in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages