autocommit 2022-03-11 19:24:53 CET
This commit is contained in:
parent
b1890894b2
commit
0ae73ab9c4
9 changed files with 277 additions and 66 deletions
|
|
@ -21,3 +21,4 @@ pub mod tri;
|
|||
pub mod vasprintf;
|
||||
pub mod vec_ext;
|
||||
pub mod vecstorage;
|
||||
pub mod nonblock;
|
||||
|
|
|
|||
8
src/utils/nonblock.rs
Normal file
8
src/utils/nonblock.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
use uapi::{c};
|
||||
use crate::utils::oserror::OsError;
|
||||
|
||||
pub fn set_nonblock(fd: c::c_int) -> Result<(), OsError> {
|
||||
let fl = uapi::fcntl_getfl(fd)?;
|
||||
uapi::fcntl_setfl(fd, fl | c::SOCK_NONBLOCK)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -24,4 +24,8 @@ impl<T> SyncQueue<T> {
|
|||
pub fn pop(&self) -> Option<T> {
|
||||
unsafe { self.el.get().deref_mut().pop_front() }
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
unsafe { self.el.get().deref_mut().is_empty() }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue