///|
pub type TaskSemaphore = @async_semaphore.Semaphore

///|
pub type TaskCond = @async_cond_var.Cond

///|
pub fn task_semaphore(size : Int, initial_value? : Int = size) -> TaskSemaphore {
  @async_semaphore.Semaphore::new(size, initial_value~)
}

///|
pub async fn task_semaphore_acquire(sem : TaskSemaphore) -> Unit {
  @async_semaphore.Semaphore::acquire(sem)
}

///|
pub fn task_semaphore_try_acquire(sem : TaskSemaphore) -> Bool {
  @async_semaphore.Semaphore::try_acquire(sem)
}

///|
pub fn task_semaphore_release(sem : TaskSemaphore) -> Unit {
  @async_semaphore.Semaphore::release(sem)
}

///|
pub fn task_cond() -> TaskCond {
  @async_cond_var.Cond::new()
}

///|
pub async fn task_cond_wait(cond : TaskCond) -> Unit {
  @async_cond_var.Cond::wait(cond)
}

///|
pub fn task_cond_signal(cond : TaskCond) -> Unit {
  @async_cond_var.Cond::signal(cond)
}

///|
pub fn task_cond_broadcast(cond : TaskCond) -> Unit {
  @async_cond_var.Cond::broadcast(cond)
}

///|
pub async fn task_pause() -> Unit {
  @async.pause()
}