1use std::{iter, mem};
2
3use crate::{Errno, kernel::errno};
4
5pub mod signal;
6pub mod timer;
7
8pub mod affinity;
9mod attrs;
10mod handle;
11pub mod raw;
12
13pub use attrs::Attrs;
14pub use handle::Handle;
15
16pub const STACK_MIN: usize = libc::PTHREAD_STACK_MIN;
18
19pub trait Thread: errno::Source {
21 type Cpus: DoubleEndedIterator<Item = affinity::raw::Cpu>
22 + ExactSizeIterator
23 + iter::FusedIterator;
24 type Timer: crate::Timer;
25 type Receiver: signal::raw::Receiver;
26
27 fn current() -> Result<Self::Cpus, affinity::Error>;
28 fn bind(cpu: affinity::raw::Cpu) -> Result<(), affinity::Error>;
29
30 fn is_main() -> bool;
32
33 fn entropy<const N: usize>(
35 bytes: &mut mem::MaybeUninit<[u8; N]>,
36 ) -> Result<&mut [u8; N], Errno> {
37 raw::entropy::<Self, N>(bytes)
38 }
39}