signal: remove redundant Pin around globals (#5303)

This commit is contained in:
Alice Ryhl
2022-12-18 09:42:59 +01:00
committed by GitHub
parent d9e0f66113
commit b9ae7e6659
2 changed files with 3 additions and 5 deletions
+2 -3
View File
@@ -5,7 +5,6 @@ use crate::sync::watch;
use crate::util::once_cell::OnceCell;
use std::ops;
use std::pin::Pin;
use std::sync::atomic::{AtomicBool, Ordering};
pub(crate) type EventId = usize;
@@ -162,14 +161,14 @@ where
}
}
pub(crate) fn globals() -> Pin<&'static Globals>
pub(crate) fn globals() -> &'static Globals
where
OsExtraData: 'static + Send + Sync + Init,
OsStorage: 'static + Send + Sync + Init,
{
static GLOBALS: OnceCell<Globals> = OnceCell::new();
Pin::new(GLOBALS.get(globals_init))
GLOBALS.get(globals_init)
}
#[cfg(all(test, not(loom)))]
+1 -2
View File
@@ -14,7 +14,6 @@ use crate::sync::watch;
use mio::net::UnixStream;
use std::io::{self, Error, ErrorKind, Write};
use std::pin::Pin;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Once;
use std::task::{Context, Poll};
@@ -240,7 +239,7 @@ impl Default for SignalInfo {
/// 2. Wake up the driver by writing a byte to a pipe
///
/// Those two operations should both be async-signal safe.
fn action(globals: Pin<&'static Globals>, signal: libc::c_int) {
fn action(globals: &'static Globals, signal: libc::c_int) {
globals.record_event(signal as EventId);
// Send a wakeup, ignore any errors (anything reasonably possible is