subscribe to mut fds

This commit is contained in:
Pat Hickey
2021-04-26 16:06:56 -07:00
parent 867d2c9a35
commit a532d0f379
4 changed files with 39 additions and 11 deletions

View File

@@ -3,7 +3,7 @@ use crate::file::WasiFile;
use crate::Error;
use bitflags::bitflags;
use cap_std::time::{Duration, Instant};
use std::cell::{Cell, Ref};
use std::cell::{Cell, RefMut};
bitflags! {
pub struct RwEventFlags: u32 {
@@ -12,12 +12,12 @@ bitflags! {
}
pub struct RwSubscription<'a> {
pub file: Ref<'a, dyn WasiFile>,
pub file: RefMut<'a, dyn WasiFile>,
status: Cell<Option<Result<(u64, RwEventFlags), Error>>>,
}
impl<'a> RwSubscription<'a> {
pub fn new(file: Ref<'a, dyn WasiFile>) -> Self {
pub fn new(file: RefMut<'a, dyn WasiFile>) -> Self {
Self {
file,
status: Cell::new(None),