Closed tjhu closed 4 years ago
CondVar is implemented in https://github.com/mars-research/redleaf/blob/118864ae2150f2e621cfc0acd3c9fd369e5c8522/src/sync/condvar.rs
Userspace sleepmutex wrapper is implemented here https://github.com/mars-research/redleaf/blob/118864ae2150f2e621cfc0acd3c9fd369e5c8522/sys/lib/libsyscalls/src/sync/sleepmutex.rs
Implement a Rust equivalent of
sleep()
in xv6. This is tricky because one cannot lock/unlock a lock in arbitrary places in Rust. A condition variable is probably the closet thing to it, but it requires us to implement our own mutex, our own condition variable, and get them right.Plan 1
Implement our own
std::sync::{Mutex, CondVar}
. Maybe we can fork theMutex
from thespin
crate, implementCondVar
on top of it, and call it for the day. It would be nice to implement it without anyunsafe
. Here's how it's implemented in Rust stdlib.Mutex
.CondVar