Ethernetwebsoc
Dependencies: C12832_lcd LM75B WebSocketClient mbed-rtos mbed Socket lwip-eth lwip-sys lwip
Thread.h
00001 /* Copyright (c) 2012 mbed.org */ 00002 #ifndef THREAD_H 00003 #define THREAD_H 00004 00005 #include <stdint.h> 00006 #include "cmsis_os.h" 00007 00008 namespace rtos { 00009 00010 /*! The Thread class allow defining, creating, and controlling thread functions in the system. */ 00011 class Thread { 00012 public: 00013 /*! Create a new thread, and start it executing the specified function. 00014 \param task function to be executed by this thread. 00015 \param argument pointer that is passed to the thread function as start argument. (default: NULL). 00016 \param priority initial priority of the thread function. (default: osPriorityNormal). 00017 \param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE). 00018 \param stack_pointer pointer to the stack area to be used by this thread (default: NULL). 00019 */ 00020 Thread (void (*task)(void const *argument), void *argument=NULL, 00021 osPriority priority=osPriorityNormal, 00022 uint32_t stack_size=DEFAULT_STACK_SIZE, 00023 unsigned char *stack_pointer=NULL); 00024 00025 /*! Terminate execution of a thread and remove it from Active Threads 00026 \return status code that indicates the execution status of the function. 00027 */ 00028 osStatus terminate (); 00029 00030 /*! Set priority of an active thread 00031 \param priority new priority value for the thread function. 00032 \return status code that indicates the execution status of the function. 00033 */ 00034 osStatus set_priority (osPriority priority); 00035 00036 /*! Get priority of an active thread 00037 \ return current priority value of the thread function. 00038 */ 00039 osPriority get_priority (); 00040 00041 /*! Set the specified Signal Flags of an active thread. 00042 \param signals specifies the signal flags of the thread that should be set. 00043 \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters. 00044 */ 00045 int32_t signal_set (int32_t signals); 00046 00047 /*! Wait for one or more Signal Flags to become signaled for the current RUNNING thread. 00048 \param signals wait until all specified signal flags set or 0 for any single signal flag. 00049 \param millisec timeout value or 0 in case of no time-out. (default: osWaitForever). 00050 \return event flag information or error code. 00051 */ 00052 static osEvent signal_wait (int32_t signals, uint32_t millisec=osWaitForever); 00053 00054 00055 /*! Wait for a specified time period in millisec: 00056 \param millisec time delay value 00057 \return status code that indicates the execution status of the function. 00058 */ 00059 static osStatus wait (uint32_t millisec); 00060 00061 /*! Pass control to next thread that is in state READY. 00062 \return status code that indicates the execution status of the function. 00063 */ 00064 static osStatus yield (); 00065 00066 /*! Get the thread id of the current running thread. 00067 \return thread ID for reference by other functions or NULL in case of error. 00068 */ 00069 static osThreadId gettid (); 00070 00071 private: 00072 osThreadId _tid; 00073 osThreadDef_t _thread_def; 00074 }; 00075 00076 } 00077 #endif
Generated on Tue Jul 12 2022 19:26:07 by 1.7.2