跳至主要內容
Knowledgebase
Home
Renesas Electronics Taiwan - Knowledgebase

Using Semaphores FAQ

Latest Updated:10/04/2016

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:

tx_semaphore_create

tx_semaphore_delete

tx_semaphore_get

tx_semaphore_put

tx_semaphore_put_notify

tx_semaphore_info_get

tx_semaphore_performance_info_get

tx_semaphore_performance_system_info_get

tx_semaphore_prioritize

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:

https://www.renesas.com/en-us/products/synergy/software.html# 

 

©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.

 

  • 本文是否實用?