1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! CPU resources for the tcontract stack: scratch memory and contraction policy.
//!
//! Placement (where tasks run, and how many at once) belongs to
//! [`threadteam`]: a host owns a [`threadteam::Pool`], lends it through
//! [`Pool`], and each operation takes an [`Exec`], a bundle of one
//! [`threadteam::Exec`] token, an optional workspace and a [`BatchPolicy`].
//! This crate starts no task and exposes no scheduler type. See
//! `PERFORMANCE_TIPS.md`, CPU Threading Contract.
//!
//! # Examples
//!
//! ```
//! use tcontract_exec::{Exec, Pool};
//! let sp = threadteam::Pool::builder().threads(2).build().unwrap();
//! let pool = Pool::borrow(&sp);
//! let mut exec = Exec::new(&pool, 2).unwrap();
//! assert_eq!(exec.budget(), pool.size().min(2));
//! let total = std::sync::atomic::AtomicUsize::new(0);
//! exec.token().for_ranges(100, 1.try_into().unwrap(), |r| {
//! total.fetch_add(r.len(), std::sync::atomic::Ordering::Relaxed);
//! });
//! assert_eq!(total.into_inner(), 100);
//! ```
pub use ;
pub use ExecError;
pub use Exec;
pub use with_faer_par;
pub use HostClass;
pub use Pool;
pub use ;