use std::{iter, mem};
use crate::{Errno, kernel::errno};
pub mod signal;
pub mod timer;
pub mod affinity;
pub mod raw;
cfg_select! {
target_arch = "aarch64" => {
mod aarch64;
use aarch64::crc32;
}
target_arch = "x86_64" => {
mod x86_64;
use x86_64::crc32;
}
_ => {
mod scalar;
use scalar::crc32;
}
}
pub const STACK_MIN: usize = libc::PTHREAD_STACK_MIN;
pub trait Thread: errno::Source {
type Cpus: DoubleEndedIterator<Item = affinity::raw::Cpu>
+ ExactSizeIterator
+ iter::FusedIterator;
type Timer: crate::Timer;
type Receiver: signal::raw::Receiver;
fn current() -> Result<Self::Cpus, affinity::Error>;
fn bind(cpu: affinity::raw::Cpu) -> Result<(), affinity::Error>;
fn crc32() -> Option<bool> {
crc32()
}
fn entropy<const N: usize>(
bytes: &mut mem::MaybeUninit<[u8; N]>,
) -> Result<&mut [u8; N], Errno> {
raw::entropy::<Self, N>(bytes)
}
}