pub const fn new(permits: usize) -> Self {
        debug_assert!(permits >= 1);
        Self {
            permits: AtomicUsize::new(permits),
            waiters: SegQueue::new(),
        }
    }
/// Creates a new semaphore with the initial number of permits.
///
/// # Examples
///
/// ```
/// # use qp::sync::Semaphore;
/// let binary_semaphore = Semaphore::new(1);
/// ```
Creates a new semaphore with the initial number of permits.
Creates a new semaphore with the initial number of permits .
pub const fn new(permits: usize) -> Self {
        debug_assert!(permits >= 1);
        Self {
            permits: AtomicUsize::new(permits),
            waiters: SegQueue::new(),
        }
    }
pub const fn new ( permits : usize ) -> Self { debug_assert ! ( permits 1 ) ; Self { permits : AtomicUsize :: new ( permits ) , waiters : SegQueue :: new ( ) , } }
Creates a new semaphore with the initial number of permits.
Creates a new semaphore with the initial number of permits .
permits
usize
examples
None
use qp::sync::semaphore;
let binary_semaphore = Semaphore::new(1);
```
let binary_semaphore = Semaphore :: new ( 1 ) ; ` ` `