xwayland: use io_uring to prevent lockups
See https://gitlab.freedesktop.org/wayland/wayland/-/issues/296
This commit is contained in:
parent
5573b2a1b7
commit
285724b4f1
13 changed files with 1173 additions and 34 deletions
|
|
@ -25,6 +25,7 @@ impl Debug for AsyncEvent {
|
|||
|
||||
impl AsyncEvent {
|
||||
pub fn clear(&self) {
|
||||
self.triggers.set(0);
|
||||
self.waker.take();
|
||||
}
|
||||
|
||||
|
|
|
|||
34
src/utils/mmap.rs
Normal file
34
src/utils/mmap.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
use {
|
||||
crate::utils::{oserror::OsError, ptr_ext::PtrExt},
|
||||
std::ptr,
|
||||
uapi::c,
|
||||
};
|
||||
|
||||
pub struct Mmapped {
|
||||
pub ptr: *const [u8],
|
||||
}
|
||||
|
||||
pub fn mmap(
|
||||
len: usize,
|
||||
prot: c::c_int,
|
||||
flags: c::c_int,
|
||||
fd: c::c_int,
|
||||
offset: c::off_t,
|
||||
) -> Result<Mmapped, OsError> {
|
||||
let res = unsafe { c::mmap(ptr::null_mut(), len, prot, flags, fd, offset) };
|
||||
if res == c::MAP_FAILED {
|
||||
Err(OsError::default())
|
||||
} else {
|
||||
Ok(Mmapped {
|
||||
ptr: unsafe { std::slice::from_raw_parts(res.cast(), len) },
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Mmapped {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
c::munmap(self.ptr.deref().as_ptr() as _, self.ptr.deref().len());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue