Skip to main content

StackSizeClass

Enum StackSizeClass 

Source
pub enum StackSizeClass {
    Small,
    Medium,
    Big,
}
Expand description

Stack-size class — epicsThreadStackSizeClass (epicsThread.h:91).

The byte size is implementation-dependent in C. These mirror the POSIX table STACK_SIZE(f) = f * 0x10000 * sizeof(void*) (libcom/src/osi/os/posix/osdThread.c:506-509), pointer-width parameterised exactly as the C macro is: Small = 1, Medium = 2, Big = 4 units of 0x10000 * sizeof(void*). On a 64-bit host that is 512 KiB / 1 MiB / 2 MiB; on armv7-rtems-eabihf it is 256 KiB / 512 KiB / 1 MiB.

§This is the table a C IOC on RTEMS 6 uses too

Base has a second, much smaller table — 5000 / 8000 / 11000 bytes, floored at RTEMS_MINIMUM_STACK_SIZE — in os/RTEMS-score/osdThread.c:136-150. It does not apply here. configure/toolchain.c:29-35 selects OS_API = posix for __RTEMS_MAJOR__ >= 5, so an RTEMS 6 build searches os/RTEMS-posix then os/RTEMS, neither of which contains an osdThread.c, and lands on os/posix/osdThread.c — the file above. The score table is what RTEMS 4/5 used.

Do not “align” these constants with 5000/8000/11000. That would be a regression against the C IOC we are matching, not a correction: on RTEMS 6 the C IOC asks pthread_attr_setstacksize for the POSIX number (os/posix/osdThread.c:212-215), which is the same call std makes for us, with the same argument.

Variants§

§

Small

§

Medium

§

Big

Implementations§

Source§

impl StackSizeClass

Source

pub fn bytes(self) -> usize

Stack size in bytes for this class, matching the POSIX stackSizeTable in osdThread.c on every target.

C’s STACK_SIZE(f) = f * 0x10000 * sizeof(void*) is parameterised by pointer width and so is this, so the two agree by construction rather than on one word size: 512 KiB / 1 MiB / 2 MiB on a 64-bit host, and 256 KiB / 512 KiB / 1 MiB on armv7-rtems-eabihf — which is exactly what a C IOC asks pthread_attr_setstacksize for on that target.

Read “on a 64-bit target” here before: it was wrong in the direction that matters, because the only target this crate is portable to is 32-bit, and it invited a reader to assume the RTEMS numbers were unverified.

Trait Implementations§

Source§

impl Clone for StackSizeClass

Source§

fn clone(&self) -> StackSizeClass

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for StackSizeClass

Source§

impl Debug for StackSizeClass

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for StackSizeClass

Source§

impl PartialEq for StackSizeClass

Source§

fn eq(&self, other: &StackSizeClass) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for StackSizeClass

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more