TAILIEUCHUNG - Real-Time Embedded Multithreading Using ThreadX and MIPS- P20
Real-Time Embedded Multithreading Using ThreadX and MIPS- P20: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. | G-4 Appendix G TX_SEMAPHORE_ERROR 0x0C Invalid semaphore pointer. Either the pointer is NULL or the semaphore has already been created. TX_CALLER_ERROR 0x13 Invalid caller of this service. Allowed From Initialization and threads Preemption Possible No Example TX_SEMAPHORE my_semaphore UINT status Create a counting semaphore with an initial value of 1. This is typically the technique used to create a binary semaphore. Binary semaphores are used to provide protection over a common resource. status tx_semaphore_create my_semaphore my_semaphore_name 1 If status equals TX_SUCCESS my_semaphore is ready for use. tx_semaphore_delete Delete a counting semaphore Prototype UINT tx_semaphore_delete TX_SEMAPHORE semaphore_ptr Description This service deletes the specified counting semaphore. All threads suspended waiting for an instance of this semaphore are resumed and receive a TX_DELETED return status. WARNING It is the application s responsibility to prevent use of a deleted semaphore. se purchase PDF Ple on to remove this watermark. Counting Semaphore Services G-5 Parameter semaphore_ptr Pointer to a previously created semaphore s Control Block. Return Values TX_SUCCESS2 TX_SEMAPHORE_ERROR TX_CALLER_ERROR 0x00 0x0C 0x13 Successful counting semaphore deletion. Invalid counting semaphore pointer. Invalid caller of this service. Allowed From Threads Preemption Possible Yes Example TX_SEMAPHORE my_semaphore UINT status Delete counting semaphore. Assume that the counting semaphore has already been created. status tx_semaphore_delete my_semaphore If status equals TX_SUCCESS the counting semaphore is deleted. tx_semaphore_get Get an instance from a counting semaphore Prototype UINT tx_semaphore_get TX_SEMAPHORE semaphore_ptr ULONG wait_option 2This value is not affected by the TX_DISABLE_ERROR_CHECKING define that is used to disable API error checking. Please purchase PDF Split-Merge on o G-6 Appendix G Description .
đang nạp các trang xem trước