autocommit 2022-03-11 18:15:21 CET
This commit is contained in:
parent
0399772467
commit
b1890894b2
30 changed files with 2909 additions and 504 deletions
|
|
@ -16,8 +16,8 @@ pub mod queue;
|
|||
pub mod run_toplevel;
|
||||
pub mod smallmap;
|
||||
pub mod stack;
|
||||
pub mod syncqueue;
|
||||
pub mod tri;
|
||||
pub mod vasprintf;
|
||||
pub mod vec_ext;
|
||||
pub mod vecstorage;
|
||||
pub mod syncqueue;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use once_cell::sync::Lazy;
|
||||
use std::error::Error;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use uapi::c::c_int;
|
||||
use uapi::{c, Errno};
|
||||
|
||||
static ERRORS: Lazy<&'static [Option<&'static str>]> = Lazy::new(|| {
|
||||
|
|
@ -168,6 +169,21 @@ impl From<Errno> for OsError {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<c::c_int> for OsError {
|
||||
fn from(v: c_int) -> Self {
|
||||
Self(v)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for OsError {
|
||||
fn from(v: std::io::Error) -> Self {
|
||||
match v.raw_os_error() {
|
||||
Some(v) => Self(v),
|
||||
None => Self(c::EINVAL),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for OsError {}
|
||||
|
||||
impl Display for OsError {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::utils::ptr_ext::MutPtrExt;
|
||||
use std::cell::UnsafeCell;
|
||||
use std::collections::VecDeque;
|
||||
use crate::utils::ptr_ext::MutPtrExt;
|
||||
|
||||
pub struct SyncQueue<T> {
|
||||
el: UnsafeCell<VecDeque<T>>,
|
||||
|
|
@ -22,8 +22,6 @@ impl<T> SyncQueue<T> {
|
|||
}
|
||||
|
||||
pub fn pop(&self) -> Option<T> {
|
||||
unsafe {
|
||||
self.el.get().deref_mut().pop_front()
|
||||
}
|
||||
unsafe { self.el.get().deref_mut().pop_front() }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue