Removed unused atexit

This commit is contained in:
Mathias Hall-Andersen
2019-12-14 13:40:00 +01:00
parent e0db9861bc
commit c873528a55

View File

@@ -8,9 +8,6 @@ extern crate cpuprofiler;
#[cfg(feature = "profiler")] #[cfg(feature = "profiler")]
use cpuprofiler::PROFILER; use cpuprofiler::PROFILER;
#[cfg(feature = "profiler")]
use libc::atexit;
mod configuration; mod configuration;
mod platform; mod platform;
mod wireguard; mod wireguard;
@@ -29,13 +26,9 @@ use platform::tun::{PlatformTun, Status};
use platform::uapi::{BindUAPI, PlatformUAPI}; use platform::uapi::{BindUAPI, PlatformUAPI};
use platform::*; use platform::*;
// destructor which stops the profiler upon program exit.
#[cfg(feature = "profiler")]
pub extern "C" fn dtor_profiler_stop() {
}
#[cfg(feature = "profiler")] #[cfg(feature = "profiler")]
fn profiler_stop() { fn profiler_stop() {
println!("Stopping profiler");
PROFILER.lock().unwrap().stop().unwrap(); PROFILER.lock().unwrap().stop().unwrap();
} }
@@ -53,9 +46,6 @@ fn profiler_start(name: &str) {
if !Path::new(path.as_str()).exists() { if !Path::new(path.as_str()).exists() {
println!("Starting profiler: {}", path); println!("Starting profiler: {}", path);
PROFILER.lock().unwrap().start(path).unwrap(); PROFILER.lock().unwrap().start(path).unwrap();
unsafe {
assert_eq!(atexit(dtor_profiler_stop), 0);
}
break; break;
}; };
n += 1; n += 1;