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 43 44 45 46 47 48 49 50 51 52
//! Definitions for a few common task pools that we want. Generally the determining factor for what //! kind of work should go in each pool is latency requirements. //! //! For CPU-intensive work (tasks that generally spin until completion) we have a standard Compute //! pool and an AsyncCompute pool. Work that does not need to be completed to present the next //! frame should go to the AsyncCompute pool //! //! For IO-intensive work (tasks that spend very little time in a "woken" state) we have an IO //! task pool. The tasks here are expected to complete very quickly. Generally they should just //! await receiving data from somewhere (i.e. disk) and signal other systems when the data is ready //! for consumption. (likely via channels) use super::TaskPool; use std::ops::Deref; /// A newtype for a task pool for CPU-intensive work that must be completed to deliver the next /// frame #[derive(Clone)] pub struct ComputeTaskPool(pub TaskPool); impl Deref for ComputeTaskPool { type Target = TaskPool; fn deref(&self) -> &Self::Target { &self.0 } } /// A newtype for a task pool for CPU-intensive work that may span across multiple frames #[derive(Clone)] pub struct AsyncComputeTaskPool(pub TaskPool); impl Deref for AsyncComputeTaskPool { type Target = TaskPool; fn deref(&self) -> &Self::Target { &self.0 } } /// A newtype for a task pool for IO-intensive work (i.e. tasks that spend very little time in a /// "woken" state) #[derive(Clone)] pub struct IOTaskPool(pub TaskPool); impl Deref for IOTaskPool { type Target = TaskPool; fn deref(&self) -> &Self::Target { &self.0 } }