Feat: clean the codebase as much as possible

This commit is contained in:
2026-02-21 14:46:53 +01:00
parent ab353edc0b
commit 7a95207c58
17 changed files with 233 additions and 368 deletions

View File

@@ -28,27 +28,16 @@ mod memory {
false
}
}
#[allow(dead_code)]
pub fn is_memory_locked() -> bool {
MLOCKALL_SUCCESS.load(Ordering::Relaxed)
}
}
#[cfg(target_os = "linux")]
pub use memory::{is_memory_locked, lock_memory};
pub use memory::lock_memory;
#[cfg(not(target_os = "linux"))]
pub fn lock_memory() -> bool {
true
}
#[cfg(not(target_os = "linux"))]
#[allow(dead_code)]
pub fn is_memory_locked() -> bool {
false
}
/// Attempts to set realtime scheduling priority for the current thread.
/// Returns true if RT priority was successfully set, false otherwise.
#[cfg(target_os = "macos")]
@@ -105,7 +94,7 @@ pub fn set_realtime_priority() -> bool {
/// - Configured rtprio limits in /etc/security/limits.conf:
/// @audio - rtprio 95
/// @audio - memlock unlimited
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", feature = "cli"))]
pub fn set_realtime_priority() -> bool {
use thread_priority::unix::{
set_thread_priority_and_policy, thread_native_id, NormalThreadSchedulePolicy,
@@ -138,17 +127,27 @@ pub fn set_realtime_priority() -> bool {
false
}
#[cfg(all(target_os = "linux", not(feature = "cli")))]
pub fn set_realtime_priority() -> bool {
false
}
#[cfg(not(any(unix, target_os = "windows")))]
pub fn set_realtime_priority() -> bool {
false
}
#[cfg(target_os = "windows")]
#[cfg(all(target_os = "windows", feature = "cli"))]
pub fn set_realtime_priority() -> bool {
use thread_priority::{set_current_thread_priority, ThreadPriority};
set_current_thread_priority(ThreadPriority::Max).is_ok()
}
#[cfg(all(target_os = "windows", not(feature = "cli")))]
pub fn set_realtime_priority() -> bool {
false
}
/// High-precision sleep using clock_nanosleep on Linux.
/// Uses monotonic clock for jitter-free sleeping.
#[cfg(target_os = "linux")]