Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
os.h File Reference
#include <sys/time.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <limits.h>
#include <stdint.h>
#include "openmrn_features.h"
#include "utils/macros.h"

Go to the source code of this file.

Macros

#define OS_INLINE   extern inline __attribute__((__gnu_inline__))
 Forces one definition of each inline function to be compiled.
 
#define container_of(_ptr, _type, _member)
 Get a pointer to the parent structure of one of its members.
 
#define OS_THREAD_ONCE_INIT   PTHREAD_ONCE_INIT
 initial value for one time intitialization instance
 
#define OS_PRIO_MIN   1
 lowest thread priority supported by abstraction
 
#define OS_PRIO_DEFAULT   0
 default thread priority
 
#define OS_PRIO_MAX   32
 highest thread priority suported by abstraction
 
#define OS_MQ_NONE   0
 error code for no error for message queues
 
#define OS_MQ_TIMEDOUT   1
 error code for timedout for message queues
 
#define OS_MQ_EMPTY   2
 error code for the queue being empty
 
#define OS_MQ_FULL   3
 error code for queue being full
 
#define OPENMRN_OS_WAIT_FOREVER   __LONG_LONG_MAX__
 maximum timeout period
 
#define NSEC_TO_USEC(_nsec)   (((long long)_nsec) / 1000LL)
 Convert a nanosecond value to a microsecond value.
 
#define NSEC_TO_MSEC(_nsec)   (((long long)_nsec) / 1000000LL)
 Convert a nanosecond value to a millisecond value.
 
#define NSEC_TO_SEC(_nsec)   (((long long)_nsec) / 1000000000LL)
 Convert a nanosecond value to a second value.
 
#define NSEC_TO_MIN(_nsec)   (((long long)_nsec) / 60000000000LL)
 Convert a nanosecond value to minutes.
 
#define USEC_TO_NSEC(_usec)   (((long long)_usec) * 1000LL)
 Convert a microsecond value to a nanosecond value.
 
#define USEC_TO_MSEC(_usec)   (((long long)_usec) / 1000LL)
 Convert a microsecond value to a millisecond value.
 
#define USEC_TO_SEC(_usec)   (((long long)_usec) / 1000000LL)
 Convert a microsecond value to a second value.
 
#define MSEC_TO_NSEC(_msec)   (((long long)_msec) * 1000000LL)
 Convert a millisecond value to a nanosecond value.
 
#define MSEC_TO_USEC(_msec)   (((long long)_msec) * 1000LL)
 Convert a millisecond value to a microsecond value.
 
#define MSEC_TO_SEC(_msec)   (((long long)_msec) / 1000LL)
 Convert a millisecond value to a second value.
 
#define SEC_TO_NSEC(_sec)   (((long long)_sec) * 1000000000LL)
 Convert a second value to a nanosecond value.
 
#define SEC_TO_USEC(_sec)   (((long long)_sec) * 1000000LL)
 Convert a second value to a microsecond value.
 
#define SEC_TO_MSEC(_sec)   (((long long)_sec) * 1000LL)
 Convert a second value to a millisecond value.
 
#define NSEC_TO_USEC_ROUNDED(_nsec)    ((((long long)_nsec) + 500LL) / 1000LL)
 Convert a nanosecond value to a microsecond value.
 
#define NSEC_TO_MSEC_ROUNDED(_nsec)    ((((long long)_nsec) + 500000LL) / 1000000LL)
 Convert a nanosecond value to a millisecond value.
 
#define NSEC_TO_SEC_ROUNDED(_nsec)    ((((long long)_nsec) + 500000000LL) / 1000000000LL)
 Convert a nanosecond value to a second value.
 
#define NSEC_TO_MIN_ROUNDED(_nsec)    ((((long long)_nsec) + 30000000000LL) / 60000000000LL)
 Convert a nanosecond value to minutes.
 
#define USEC_TO_MSEC_ROUNDED(_usec)    ((((long long)_usec) + 500LL) / 1000LL)
 Convert a microsecond value to a millisecond value.
 
#define USEC_TO_SEC_ROUNDED(_usec)    ((((long long)_usec) +500000LL) / 1000000LL)
 Convert a microsecond value to a second value.
 
#define MSEC_TO_SEC_ROUNDED(_msec)    ((((long long)_msec) + 500LL) / 1000LL)
 Convert a millisecond value to a second value.
 

Functions

int appl_main (int argc, char *argv[])
 Entry point to application.
 
ssize_t os_get_free_heap (void)
 
long long os_get_time_monotonic (void)
 Get the monotonic time since the system started.
 
long long os_get_fake_time (void)
 Get the fake time for a unit test.
 
OS_INLINE int os_thread_once (os_thread_once_t *once, void(*routine)(void))
 One time intialization routine.
 
int os_thread_create (os_thread_t *thread, const char *name, int priority, size_t stack_size, void *(*start_routine)(void *), void *arg)
 Creates a thread.
 
void os_thread_cancel (os_thread_t thread)
 Destroy a thread.
 
OS_INLINE os_thread_t os_thread_self (void)
 Return a handle to the calling thread.
 
OS_INLINE int os_thread_get_priority (os_thread_t thread)
 Return the current thread priority.
 
OS_INLINE int os_thread_get_priority_min (void)
 Get the minimum thread priority.
 
OS_INLINE int os_thread_get_priority_max (void)
 Get the maximum thread priority.
 
OS_INLINE int os_mutex_init (os_mutex_t *mutex)
 Initialize mutex.
 
OS_INLINE int os_recursive_mutex_init (os_mutex_t *mutex)
 Initialize recursive mutex.
 
OS_INLINE int os_mutex_destroy (os_mutex_t *mutex)
 Destroy a mutex.
 
OS_INLINE int os_mutex_lock (os_mutex_t *mutex)
 Lock a mutex.
 
OS_INLINE int os_mutex_unlock (os_mutex_t *mutex)
 Unock a mutex.
 
OS_INLINE int os_sem_init (os_sem_t *sem, unsigned int value)
 Initialize a semaphore.
 
OS_INLINE int os_sem_destroy (os_sem_t *sem)
 Destroy a semaphore.
 
OS_INLINE int os_sem_post (os_sem_t *sem)
 Post a semaphore.
 
OS_INLINE int os_sem_wait (os_sem_t *sem)
 Wait on a semaphore.
 
OS_INLINE os_mq_t os_mq_create (size_t length, size_t item_size)
 Create a new message queue.
 
OS_INLINE void os_mq_send (os_mq_t queue, const void *data)
 Blocking send of a message to a queue.
 
OS_INLINE int os_mq_timedsend (os_mq_t queue, const void *data, long long timeout)
 Send a message to a queue with a timeout.
 
OS_INLINE void os_mq_receive (os_mq_t queue, void *data)
 Blocking receive a message from a queue.
 
OS_INLINE int os_mq_timedreceive (os_mq_t queue, void *data, long long timeout)
 Receive a message from a queue.
 
OS_INLINE int os_mq_send_from_isr (os_mq_t queue, const void *data, int *woken)
 Send of a message to a queue from ISR context.
 
OS_INLINE int os_mq_is_full_from_isr (os_mq_t queue)
 Check if a queue is full from ISR context.
 
OS_INLINE int os_mq_receive_from_isr (os_mq_t queue, void *data, int *woken)
 Receive a message from a queue from ISR context.
 
OS_INLINE int os_mq_num_pending (os_mq_t queue)
 Return the number of messages pending in the queue.
 
OS_INLINE int os_mq_num_pending_from_isr (os_mq_t queue)
 Return the number of messages pending in the queue from ISR context.
 
OS_INLINE int os_mq_num_spaces (os_mq_t queue)
 Return the number of spaces available in the queue.
 

Detailed Description

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This file represents a C language abstraction of common operating system calls.

Author
Stuart W. Baker
Date
28 May 2012

Definition in file os.h.

Macro Definition Documentation

◆ container_of

#define container_of (   _ptr,
  _type,
  _member 
)
Value:
({ \
const typeof( ((_type *)0)->_member ) *__mptr = (_ptr); \
(_type *)( (char *)__mptr - offsetof(_type,_member) ); \
})

Get a pointer to the parent structure of one of its members.

Parameters
_ptroriginal member pointer
_typeparent structure type
_membername of member within structure
Returns
pointer to the parent structure

Definition at line 155 of file os.h.

◆ MSEC_TO_NSEC

#define MSEC_TO_NSEC (   _msec)    (((long long)_msec) * 1000000LL)

Convert a millisecond value to a nanosecond value.

Parameters
_msecmillisecond value to convert
Returns
nanosecond value

Definition at line 268 of file os.h.

◆ MSEC_TO_SEC

#define MSEC_TO_SEC (   _msec)    (((long long)_msec) / 1000LL)

Convert a millisecond value to a second value.

Parameters
_msecmillisecond value to convert
Returns
second value

Definition at line 280 of file os.h.

◆ MSEC_TO_SEC_ROUNDED

#define MSEC_TO_SEC_ROUNDED (   _msec)     ((((long long)_msec) + 500LL) / 1000LL)

Convert a millisecond value to a second value.

Parameters
_msecmillisecond value to convert
Returns
second value

Definition at line 346 of file os.h.

◆ MSEC_TO_USEC

#define MSEC_TO_USEC (   _msec)    (((long long)_msec) * 1000LL)

Convert a millisecond value to a microsecond value.

Parameters
_msecmillisecond value to convert
Returns
microsecond value

Definition at line 274 of file os.h.

◆ NSEC_TO_MIN

#define NSEC_TO_MIN (   _nsec)    (((long long)_nsec) / 60000000000LL)

Convert a nanosecond value to minutes.

Parameters
_nsecnanosecond value to convert
Returns
minutes value

Definition at line 244 of file os.h.

◆ NSEC_TO_MIN_ROUNDED

#define NSEC_TO_MIN_ROUNDED (   _nsec)     ((((long long)_nsec) + 30000000000LL) / 60000000000LL)

Convert a nanosecond value to minutes.

Parameters
_nsecnanosecond value to convert
Returns
minutes value

Definition at line 325 of file os.h.

◆ NSEC_TO_MSEC

#define NSEC_TO_MSEC (   _nsec)    (((long long)_nsec) / 1000000LL)

Convert a nanosecond value to a millisecond value.

Parameters
_nsecnanosecond value to convert
Returns
milliosecond value

Definition at line 232 of file os.h.

◆ NSEC_TO_MSEC_ROUNDED

#define NSEC_TO_MSEC_ROUNDED (   _nsec)     ((((long long)_nsec) + 500000LL) / 1000000LL)

Convert a nanosecond value to a millisecond value.

Parameters
_nsecnanosecond value to convert
Returns
milliosecond value

Definition at line 311 of file os.h.

◆ NSEC_TO_SEC

#define NSEC_TO_SEC (   _nsec)    (((long long)_nsec) / 1000000000LL)

Convert a nanosecond value to a second value.

Parameters
_nsecnanosecond value to convert
Returns
second value

Definition at line 238 of file os.h.

◆ NSEC_TO_SEC_ROUNDED

#define NSEC_TO_SEC_ROUNDED (   _nsec)     ((((long long)_nsec) + 500000000LL) / 1000000000LL)

Convert a nanosecond value to a second value.

Parameters
_nsecnanosecond value to convert
Returns
second value

Definition at line 318 of file os.h.

◆ NSEC_TO_USEC

#define NSEC_TO_USEC (   _nsec)    (((long long)_nsec) / 1000LL)

Convert a nanosecond value to a microsecond value.

Parameters
_nsecnanosecond value to convert
Returns
microsecond value

Definition at line 226 of file os.h.

◆ NSEC_TO_USEC_ROUNDED

#define NSEC_TO_USEC_ROUNDED (   _nsec)     ((((long long)_nsec) + 500LL) / 1000LL)

Convert a nanosecond value to a microsecond value.

Parameters
_nsecnanosecond value to convert
Returns
microsecond value

Definition at line 304 of file os.h.

◆ OPENMRN_OS_WAIT_FOREVER

#define OPENMRN_OS_WAIT_FOREVER   __LONG_LONG_MAX__

maximum timeout period

Definition at line 219 of file os.h.

◆ OS_INLINE

#define OS_INLINE   extern inline __attribute__((__gnu_inline__))

Forces one definition of each inline function to be compiled.

Definition at line 77 of file os.h.

◆ OS_MQ_EMPTY

#define OS_MQ_EMPTY   2

error code for the queue being empty

Definition at line 213 of file os.h.

◆ OS_MQ_FULL

#define OS_MQ_FULL   3

error code for queue being full

Definition at line 214 of file os.h.

◆ OS_MQ_NONE

#define OS_MQ_NONE   0

error code for no error for message queues

Definition at line 211 of file os.h.

◆ OS_MQ_TIMEDOUT

#define OS_MQ_TIMEDOUT   1

error code for timedout for message queues

Definition at line 212 of file os.h.

◆ OS_PRIO_DEFAULT

#define OS_PRIO_DEFAULT   0

default thread priority

Definition at line 208 of file os.h.

◆ OS_PRIO_MAX

#define OS_PRIO_MAX   32

highest thread priority suported by abstraction

Definition at line 209 of file os.h.

◆ OS_PRIO_MIN

#define OS_PRIO_MIN   1

lowest thread priority supported by abstraction

Definition at line 207 of file os.h.

◆ OS_THREAD_ONCE_INIT

#define OS_THREAD_ONCE_INIT   PTHREAD_ONCE_INIT

initial value for one time intitialization instance

Definition at line 185 of file os.h.

◆ SEC_TO_MSEC

#define SEC_TO_MSEC (   _sec)    (((long long)_sec) * 1000LL)

Convert a second value to a millisecond value.

Parameters
_secsecond value to convert
Returns
millisecond value

Definition at line 298 of file os.h.

◆ SEC_TO_NSEC

#define SEC_TO_NSEC (   _sec)    (((long long)_sec) * 1000000000LL)

Convert a second value to a nanosecond value.

Parameters
_secsecond value to convert
Returns
nanosecond value

Definition at line 286 of file os.h.

◆ SEC_TO_USEC

#define SEC_TO_USEC (   _sec)    (((long long)_sec) * 1000000LL)

Convert a second value to a microsecond value.

Parameters
_secsecond value to convert
Returns
microsecond value

Definition at line 292 of file os.h.

◆ USEC_TO_MSEC

#define USEC_TO_MSEC (   _usec)    (((long long)_usec) / 1000LL)

Convert a microsecond value to a millisecond value.

Parameters
_usecmicrosecond value to convert
Returns
millisecond value

Definition at line 256 of file os.h.

◆ USEC_TO_MSEC_ROUNDED

#define USEC_TO_MSEC_ROUNDED (   _usec)     ((((long long)_usec) + 500LL) / 1000LL)

Convert a microsecond value to a millisecond value.

Parameters
_usecmicrosecond value to convert
Returns
millisecond value

Definition at line 332 of file os.h.

◆ USEC_TO_NSEC

#define USEC_TO_NSEC (   _usec)    (((long long)_usec) * 1000LL)

Convert a microsecond value to a nanosecond value.

Parameters
_usecmicrosecond value to convert
Returns
nanosecond value

Definition at line 250 of file os.h.

◆ USEC_TO_SEC

#define USEC_TO_SEC (   _usec)    (((long long)_usec) / 1000000LL)

Convert a microsecond value to a second value.

Parameters
_usecmicrosecond value to convert
Returns
second value

Definition at line 262 of file os.h.

◆ USEC_TO_SEC_ROUNDED

#define USEC_TO_SEC_ROUNDED (   _usec)     ((((long long)_usec) +500000LL) / 1000000LL)

Convert a microsecond value to a second value.

Parameters
_usecmicrosecond value to convert
Returns
second value

Definition at line 339 of file os.h.

Function Documentation

◆ appl_main()

int appl_main ( int  argc,
char *  argv[] 
)

Entry point to application.

Parameters
argcnumber of arguments
argvlist of arguments
Returns
0 upon success.

Definition at line 66 of file test_main.hxx.

◆ os_get_fake_time()

long long os_get_fake_time ( void  )
extern

Get the fake time for a unit test.

Returns
time in nanoseconds, <= 0 if there is no fake clock.

◆ os_get_free_heap()

ssize_t os_get_free_heap ( void  )
Returns
the available heap or -1 if this operation is not supported.

Definition at line 914 of file os.c.

◆ os_get_time_monotonic()

long long os_get_time_monotonic ( void  )
extern

Get the monotonic time since the system started.

Returns
time in nanoseconds since system start

Definition at line 571 of file os.c.

◆ os_mq_create()

OS_INLINE os_mq_t os_mq_create ( size_t  length,
size_t  item_size 
)

Create a new message queue.

Parameters
lengthlength in number of messages of the queue
item_sizesize in number of bytes of a message
Returns
handle to the created queue, NULL on failure

Definition at line 800 of file os.h.

◆ os_mq_is_full_from_isr()

OS_INLINE int os_mq_is_full_from_isr ( os_mq_t  queue)

Check if a queue is full from ISR context.

Parameters
queueis the queue to check
Returns
non-zero if the queue is full.

Definition at line 942 of file os.h.

◆ os_mq_num_pending()

OS_INLINE int os_mq_num_pending ( os_mq_t  queue)

Return the number of messages pending in the queue.

Parameters
queuequeue to check
Returns
number of messages in the queue

Definition at line 978 of file os.h.

◆ os_mq_num_pending_from_isr()

OS_INLINE int os_mq_num_pending_from_isr ( os_mq_t  queue)

Return the number of messages pending in the queue from ISR context.

Parameters
queuequeue to check
Returns
number of messages in the queue

Definition at line 992 of file os.h.

◆ os_mq_num_spaces()

OS_INLINE int os_mq_num_spaces ( os_mq_t  queue)

Return the number of spaces available in the queue.

Parameters
queuequeue to check
Returns
number of spaces available

Definition at line 1006 of file os.h.

◆ os_mq_receive()

OS_INLINE void os_mq_receive ( os_mq_t  queue,
void *  data 
)

Blocking receive a message from a queue.

Parameters
queuequeue to receive message from
datalocation to copy message from the queue

Definition at line 875 of file os.h.

◆ os_mq_receive_from_isr()

OS_INLINE int os_mq_receive_from_isr ( os_mq_t  queue,
void *  data,
int *  woken 
)

Receive a message from a queue from ISR context.

Parameters
queuequeue to receive message from
datalocation to copy message from the queue
wokenis the task woken up
Returns
OS_MQ_NONE on success, else OS_MQ_FULL

Definition at line 959 of file os.h.

◆ os_mq_send()

OS_INLINE void os_mq_send ( os_mq_t  queue,
const void *  data 
)

Blocking send of a message to a queue.

Parameters
queuequeue to send message to
datamessage to copy into queue

Definition at line 828 of file os.h.

◆ os_mq_send_from_isr()

OS_INLINE int os_mq_send_from_isr ( os_mq_t  queue,
const void *  data,
int *  woken 
)

Send of a message to a queue from ISR context.

Parameters
queuequeue to send message to
datamessage to copy into queue
wokenis the task woken up
Returns
OS_MQ_NONE on success, else OS_MQ_FULL

Definition at line 923 of file os.h.

◆ os_mq_timedreceive()

OS_INLINE int os_mq_timedreceive ( os_mq_t  queue,
void *  data,
long long  timeout 
)

Receive a message from a queue.

Parameters
queuequeue to receive message from
datalocation to copy message from the queue
timeouttime in nanoseconds to wait for queue to have a message available
Returns
OS_MQ_NONE on success, OS_MQ_TIMEDOUT on timeout

Definition at line 902 of file os.h.

◆ os_mq_timedsend()

OS_INLINE int os_mq_timedsend ( os_mq_t  queue,
const void *  data,
long long  timeout 
)

Send a message to a queue with a timeout.

Parameters
queuequeue to send message to
datamessage to copy into queue
timeouttime in nanoseconds to wait for queue to be able to accept message
Returns
OS_MQ_NONE on success, OS_MQ_TIMEDOUT on timeout

Definition at line 855 of file os.h.

◆ os_mutex_destroy()

OS_INLINE int os_mutex_destroy ( os_mutex_t *  mutex)

Destroy a mutex.

Parameters
mutexaddress of mutex handle to destroy
Returns
0 upon succes or error number upon failure

Definition at line 515 of file os.h.

◆ os_mutex_init()

OS_INLINE int os_mutex_init ( os_mutex_t *  mutex)

Initialize mutex.

Parameters
mutexaddress of mutex handle to initialize
Returns
0 upon succes or error number upon failure

Definition at line 460 of file os.h.

◆ os_mutex_lock()

OS_INLINE int os_mutex_lock ( os_mutex_t *  mutex)

Lock a mutex.

Parameters
mutexaddress of mutex handle to lock
Returns
0 upon succes or error number upon failure

Definition at line 533 of file os.h.

◆ os_mutex_unlock()

OS_INLINE int os_mutex_unlock ( os_mutex_t *  mutex)

Unock a mutex.

Parameters
mutexaddress of mutex handle to unlock
Returns
0 upon succes or error number upon failure

Definition at line 575 of file os.h.

◆ os_recursive_mutex_init()

OS_INLINE int os_recursive_mutex_init ( os_mutex_t *  mutex)

Initialize recursive mutex.

Parameters
mutexaddress of mutex handle to initialize
Returns
0 upon succes or error number upon failure

Definition at line 480 of file os.h.

◆ os_sem_destroy()

OS_INLINE int os_sem_destroy ( os_sem_t *  sem)

Destroy a semaphore.

Parameters
semaddress of semaphore to destroy
Returns
0 upon success

Definition at line 627 of file os.h.

◆ os_sem_init()

OS_INLINE int os_sem_init ( os_sem_t *  sem,
unsigned int  value 
)

Initialize a semaphore.

Parameters
semaddress of semaphore to initialize
valueinitial value of semaphore
Returns
0 upon success

Definition at line 604 of file os.h.

◆ os_sem_post()

OS_INLINE int os_sem_post ( os_sem_t *  sem)

Post a semaphore.

Parameters
semaddress of semaphore to increment
Returns
0 upon success

Definition at line 645 of file os.h.

◆ os_sem_wait()

OS_INLINE int os_sem_wait ( os_sem_t *  sem)

Wait on a semaphore.

Parameters
semaddress of semaphore to decrement
Returns
0 upon success

Definition at line 681 of file os.h.

◆ os_thread_cancel()

void os_thread_cancel ( os_thread_t  thread)

Destroy a thread.

Parameters
threadhandle to the created thread

◆ os_thread_create()

int os_thread_create ( os_thread_t *  thread,
const char *  name,
int  priority,
size_t  stack_size,
void *(*)(void *)  start_routine,
void *  arg 
)

Creates a thread.

Parameters
threadhandle to the created thread
namename of thread, NULL for an auto generated name
prioritypriority of created thread, 0 means default
stack_sizesize in bytes of the created thread's stack
start_routineentry point of the thread
argentry parameter to the thread
Returns
0 upon success or error number upon failure

Creates a thread.

Parameters
threadhandle to the created thread
namename of thread, NULL for an auto generated name
prioritypriority of created thread, 0 means default, lower numbers means lower priority, higher numbers mean higher priority
stack_sizesize in bytes of the created thread's stack
start_routineentry point of the thread
argentry parameter to the thread
Returns
0 upon success or error number upon failure

Definition at line 450 of file os.c.

◆ os_thread_get_priority()

OS_INLINE int os_thread_get_priority ( os_thread_t  thread)

Return the current thread priority.

Parameters
threadhandle to thread of interest
Returns
current thread priority

Definition at line 385 of file os.h.

◆ os_thread_get_priority_max()

OS_INLINE int os_thread_get_priority_max ( void  )

Get the maximum thread priority.

Returns
maximum trhead priority

Definition at line 416 of file os.h.

◆ os_thread_get_priority_min()

OS_INLINE int os_thread_get_priority_min ( void  )

Get the minimum thread priority.

Returns
minimum trhead priority

Definition at line 402 of file os.h.

◆ os_thread_once()

OS_INLINE int os_thread_once ( os_thread_once_t *  once,
void(*)(void)  routine 
)

One time intialization routine.

Parameters
onceone time instance
routinemethod to call once
Returns
0 upon success

Definition at line 201 of file os.h.

◆ os_thread_self()

OS_INLINE os_thread_t os_thread_self ( void  )

Return a handle to the calling thread.

Returns
a handle to the calling thread

Definition at line 370 of file os.h.