Skip to content

Commit

Permalink
signal: remove redundant Pin around globals (#5303)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn committed Dec 18, 2022
1 parent d9e0f66 commit b9ae7e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions tokio/src/signal/registry.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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)))]
Expand Down
3 changes: 1 addition & 2 deletions tokio/src/signal/unix.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b9ae7e6

Please sign in to comment.