Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Mbed Thread

Mbed Thread
[Platform]

Functions

uint64_t get_ms_count (void)
 Generic thread functions.
void thread_sleep_for (uint32_t millisec)
 Sleep for a specified time period in millisec:
void thread_sleep_until (uint64_t millisec)
 Sleep until a specified time in millisec The specified time is according to Kernel::get_ms_count().

Function Documentation

uint64_t get_ms_count ( void   )

Generic thread functions.

These are C versions of functions provided in C++ via rtos::Thread and rtos::ThisThread Read the current RTOS kernel millisecond tick count. The tick count corresponds to the tick count the RTOS uses for timing purposes. It increments monotonically from 0 at boot, so it effectively never wraps. If the underlying RTOS only provides a 32-bit tick count, this method expands it to 64 bits.

Returns:
RTOS kernel current tick count
Note:
Mbed OS always uses millisecond RTOS ticks, and this could only wrap after half a billion years.
In a non-RTOS build, this computes an equivalent time in milliseconds, based on a HAL timer. The time may be referenced as 0 on first call.
You cannot call this function from ISR context.
The equivalent functionality is accessible in C++ via rtos::Kernel::get_ms_count.

Definition at line 31 of file mbed_thread.cpp.

void thread_sleep_for ( uint32_t  millisec )

Sleep for a specified time period in millisec:

Parameters:
millisectime delay value
Note:
You cannot call this function from ISR context.
The equivalent functionality is accessible in C++ via rtos::ThisThread::sleep_for.

Definition at line 40 of file mbed_thread.cpp.

void thread_sleep_until ( uint64_t  millisec )

Sleep until a specified time in millisec The specified time is according to Kernel::get_ms_count().

Parameters:
millisecabsolute time in millisec
Note:
You cannot call this function from ISR context.
if millisec is equal to or lower than the current tick count, this returns immediately.
The equivalent functionality is accessible in C++ via ThisThread::sleep_until.

Definition at line 50 of file mbed_thread.cpp.