[Yellowstone] Wireframe for moving yellowstone to rust.

This commit is contained in:
Drew Galbraith 2024-08-17 20:19:45 -07:00
parent 0aa4a1f5f1
commit c9b484089e
24 changed files with 265 additions and 25 deletions

View file

@ -0,0 +1,19 @@
use crate::{cap::Capability, syscall, zion::ZError};
pub struct Semaphore {
cap: Capability,
}
impl Semaphore {
pub fn new() -> Result<Self, ZError> {
syscall::semaphore_create().map(|cap| Self { cap })
}
pub fn wait(&self) -> Result<(), ZError> {
syscall::semaphone_wait(&self.cap)
}
pub fn signal(&self) -> Result<(), ZError> {
syscall::semaphone_signal(&self.cap)
}
}