mbed-cliのインポート用

Dependencies:   F7_Ethernet mbed

Fork of Nucleo_F746ZG_Ethernet by Dieter Graef

Embed: (wiki syntax)

« Back to documentation index

Thread Class Reference

The Thread class allow defining, creating, and controlling thread functions in the system. More...

#include <Thread.h>

Public Types

enum  State {
  Inactive, Ready, Running, WaitingDelay,
  WaitingInterval, WaitingOr, WaitingAnd, WaitingSemaphore,
  WaitingMailbox, WaitingMutex
}
 

State of the Thread.

More...

Public Member Functions

 Thread (void(*task)(void const *argument), void *argument=NULL, osPriority priority=osPriorityNormal, uint32_t stack_size=DEFAULT_STACK_SIZE, unsigned char *stack_pointer=NULL)
 Create a new thread, and start it executing the specified function.
osStatus terminate ()
 Terminate execution of a thread and remove it from Active Threads.
osStatus set_priority (osPriority priority)
 Set priority of an active thread.
osPriority get_priority ()
 Get priority of an active thread.
int32_t signal_set (int32_t signals)
 Set the specified Signal Flags of an active thread.
int32_t signal_clr (int32_t signals)
 Clears the specified Signal Flags of an active thread.
State get_state ()
 State of this Thread.
uint32_t stack_size ()
 Get the total stack memory size for this Thread.
uint32_t free_stack ()
 Get the currently unused stack memory for this Thread.
uint32_t used_stack ()
 Get the currently used stack memory for this Thread.
uint32_t max_stack ()
 Get the maximum stack memory usage to date for this Thread.

Static Public Member Functions

static osEvent signal_wait (int32_t signals, uint32_t millisec=osWaitForever)
 Wait for one or more Signal Flags to become signaled for the current RUNNING thread.
static osStatus wait (uint32_t millisec)
 Wait for a specified time period in millisec:
static osStatus yield ()
 Pass control to next thread that is in state READY.
static osThreadId gettid ()
 Get the thread id of the current running thread.
static void attach_idle_hook (void(*fptr)(void))
 Attach a function to be called by the RTOS idle task.

Detailed Description

The Thread class allow defining, creating, and controlling thread functions in the system.

Definition at line 31 of file Thread.h.


Member Enumeration Documentation

enum State

State of the Thread.

Enumerator:
Inactive 

Not created or terminated.

Ready 

Ready to run.

Running 

Running.

WaitingDelay 

Waiting for a delay to occur.

WaitingInterval 

Waiting for an interval to occur.

WaitingOr 

Waiting for one event in a set to occur.

WaitingAnd 

Waiting for multiple events in a set to occur.

WaitingSemaphore 

Waiting for a semaphore event to occur.

WaitingMailbox 

Waiting for a mailbox event to occur.

WaitingMutex 

Waiting for a mutex event to occur.

Definition at line 74 of file Thread.h.


Constructor & Destructor Documentation

Thread ( void(*)(void const *argument)  task,
void *  argument = NULL,
osPriority  priority = osPriorityNormal,
uint32_t  stack_size = DEFAULT_STACK_SIZE,
unsigned char *  stack_pointer = NULL 
)

Create a new thread, and start it executing the specified function.

Parameters:
taskfunction to be executed by this thread.
argumentpointer that is passed to the thread function as start argument. (default: NULL).
priorityinitial priority of the thread function. (default: osPriorityNormal).
stack_sizestack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
stack_pointerpointer to the stack area to be used by this thread (default: NULL).

Definition at line 35 of file Thread.cpp.


Member Function Documentation

void attach_idle_hook ( void(*)(void)  fptr ) [static]

Attach a function to be called by the RTOS idle task.

Parameters:
fptrpointer to the function to be called

Definition at line 169 of file Thread.cpp.

uint32_t free_stack (  )

Get the currently unused stack memory for this Thread.

Returns:
the currently unused stack memory in bytes

Definition at line 104 of file Thread.cpp.

osPriority get_priority (  )

Get priority of an active thread.

Returns:
current priority value of the thread function.

Definition at line 67 of file Thread.cpp.

Thread::State get_state (  )

State of this Thread.

Returns:
the State of this Thread

Definition at line 79 of file Thread.cpp.

osThreadId gettid (  ) [static]

Get the thread id of the current running thread.

Returns:
thread ID for reference by other functions or NULL in case of error.

Definition at line 165 of file Thread.cpp.

uint32_t max_stack (  )

Get the maximum stack memory usage to date for this Thread.

Returns:
the maximum stack memory usage to date in bytes

Definition at line 134 of file Thread.cpp.

osStatus set_priority ( osPriority  priority )

Set priority of an active thread.

Parameters:
prioritynew priority value for the thread function.
Returns:
status code that indicates the execution status of the function.

Definition at line 63 of file Thread.cpp.

int32_t signal_clr ( int32_t  signals )

Clears the specified Signal Flags of an active thread.

Parameters:
signalsspecifies the signal flags of the thread that should be cleared.
Returns:
resultant signal flags of the specified thread or 0x80000000 in case of incorrect parameters.

Definition at line 75 of file Thread.cpp.

int32_t signal_set ( int32_t  signals )

Set the specified Signal Flags of an active thread.

Parameters:
signalsspecifies the signal flags of the thread that should be set.
Returns:
previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.

Definition at line 71 of file Thread.cpp.

osEvent signal_wait ( int32_t  signals,
uint32_t  millisec = osWaitForever 
) [static]

Wait for one or more Signal Flags to become signaled for the current RUNNING thread.

Parameters:
signalswait until all specified signal flags set or 0 for any single signal flag.
millisectimeout value or 0 in case of no time-out. (default: osWaitForever).
Returns:
event flag information or error code.

Definition at line 153 of file Thread.cpp.

uint32_t stack_size (  )

Get the total stack memory size for this Thread.

Returns:
the total stack memory size in bytes

Definition at line 91 of file Thread.cpp.

osStatus terminate (  )

Terminate execution of a thread and remove it from Active Threads.

Returns:
status code that indicates the execution status of the function.

Definition at line 59 of file Thread.cpp.

uint32_t used_stack (  )

Get the currently used stack memory for this Thread.

Returns:
the currently used stack memory in bytes

Definition at line 119 of file Thread.cpp.

osStatus wait ( uint32_t  millisec ) [static]

Wait for a specified time period in millisec:

Parameters:
millisectime delay value
Returns:
status code that indicates the execution status of the function.

Definition at line 157 of file Thread.cpp.

osStatus yield (  ) [static]

Pass control to next thread that is in state READY.

Returns:
status code that indicates the execution status of the function.

Definition at line 161 of file Thread.cpp.