Skip to main content

ThreadInfo

Struct ThreadInfo 

Source
pub struct ThreadInfo { /* private fields */ }
Expand description

One row of thread_report — what C’s epicsThreadShowInfo prints about one thread (os/Linux/osdThreadExtra.c:31-55).

Implementations§

Source§

impl ThreadInfo

Source

pub fn id(&self) -> u64

The EPICS ID column, and the handle epicsThreadShow <id> accepts.

Source

pub fn name(&self) -> &str

The NAME column: std::thread::current().name(), or noname for a thread spawned without one — C’s own placeholder for the same case (osdThread.c:601).

Source

pub fn os_id(&self) -> u64

The LWP ID column on Linux, PTHREAD ID elsewhere.

Source

pub fn epics_priority(&self) -> u8

The OSIPRI column: the EPICS priority, 0..=99.

Source

pub fn os_priority(&self) -> i32

The OSSPRI column: the OS scheduling priority the thread runs at.

C reads this live with pthread_getschedparam (osdThreadExtra.c:39). This recomputes it from the outcome the prologue recorded, through the same map that produced it, which is the same number: nothing in this workspace re-bands a thread after the prologue (only_the_prologue_reaches_the_banding_call), and the map’s other input — the probed range — is fixed for the life of the process.

Any outcome but PriorityApplied::Realtime left the thread on the default policy, whose sched_priority is 0 by POSIX. That is what C’s live read returns for those threads too, and what a non-privileged Linux IOC shows in this column for every row.

Source

pub fn is_suspended(&self) -> bool

C epicsThreadIsSuspended (osdThread.c:910-914) — the STATE column’s source, and what C’s iocsh epicsThreadResume tests before it acts (libComRegister.c:445).

Source

pub fn resume(&self) -> bool

C epicsThreadResume (osdThread.c:797-802) on this thread.

false means it was not suspended, which is the arm C’s iocsh wrapper reports as Thread %s is not suspended (libComRegister.c:445-449).

Source

pub fn show_line(&self) -> String

The row epicsThreadShowInfo prints, without its newline.

%16.16s %14p %8lu %3d%8d %8.8s%s on Linux, %12lu for the OS id elsewhere. The trailing %s is C’s ZOMBIE marker, for a thread whose function has returned but whose epicsThreadOSD is still referenced; it is always empty here because the row and the thread end together.

The %8.8s state column is C’s isSuspended ? "SUSPEND" : "OK" (os/Linux/osdThreadExtra.c:48-52), read live from the cell the thread’s own suspend_self blocks on.

Trait Implementations§

Source§

impl Clone for ThreadInfo

Source§

fn clone(&self) -> ThreadInfo

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 Debug for ThreadInfo

Source§

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

Formats the value using the given formatter. Read more

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 = !

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

fn try_from(value: U) -> Result<T, !>

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