What is a Semaphore?
A semaphore is a ThreadX component used to coordinate access to shared resources or for mutual exclusion.
What are Semaphores typically used for?
Counting semaphores are typically used for mutual exclusion. However, counting semaphores can also be used as a method for event notification.
ThreadX places no constraints on how counting semaphores are used.
How do I create a Semaphore for a Synergy program?
You can create a semaphore either directly using the service tx_semaphore_create or by adding a new semaphore object to a thread in the Threads tab of the synergy configuration.
How can a Semaphore be used for event notification?
A notification callback function can be registered to be called every time the specified semaphore is put with the tx_semaphore_put_notify. This mechanism can be used to act immediately upon the availability of a resource and avoid polling.
What Semaphore functions are available?
ThreadX provides the following services (functions) for semaphores:
For more information on these services consult the ThreadX documentation.
Where can I find some examples of Semaphore use in Synergy designs?
The thermostat example application uses a semaphore in the graphics driver and another for external IRQ handling.
Where can I find more information?
You can find more information on the ThreadX user manual, available here:
©1997-2015 by Express Logic, Inc. All rights reserved. This document and the associated ThreadX software are the sole property of Express Logic, Inc. Each contains proprietary information of Express Logic, Inc.