Real-Time Embedded Multithreading Using ThreadX and MIPS- P5:Although the history of embedded systems is relatively short, 1 the advances and successes of this fi eld have been profound. Embedded systems are found in a vast array of applications such as consumer electronics, “ smart ” devices, communication equipment, automobiles, desktop computers, and medical equipment. | 78 Chapter 7 need to create a thread entry function to complete the example. Figure contains the code necessary to create a thread and its corresponding entry function. In this figure the line TX_THREAD my_thread is used to define a thread called my_thread. Recall that TX_THREAD is a data type used to define a TCB. The line UINT status declares a variable to store the return value from the service call invocation. Each time we invoke a service call we will check the value of this status variable to determine whether the call was successful. We will use this convention for all invocations to service calls not just for thread services. The lines beginning with status tx_thread_create . Parameter Description my_thread Pointer to a thread control block defined by TX_THREAD my_thread Pointer to the name of the thread a user-defined name my_thread_entry Name of the thread entry function when the thread begins execution control is passed to this function 0x1234 A 32-bit value passed to the thread entry function this value is reserved for the exclusive use of the application VOID 0x400000 Starting address of the stack s memory area we used an actual address for the beginning location of the stack although we have many choices on how to allocate stack space 1000 Number of bytes in the stack memory area 15 Priority a value in the range from 0 to 31 inclusive must be specified 15 Preemption-threshold a value equal to the priority disables preemption-threshold TX_NO_TIME_SLICE Time-slice option this means we have disabled timeslicing for this thread TX_AUTO_START Initial thread status this means that the thread starts immediately upon creation Figure Thread create parameters used in previous figure on to remove this watermark. The Thread The Essential Component 79 create the thread where the parameters specify the characteristics of the thread. Figure contains descriptions for these parameters. We need to create a thread entry function for this .