FastSemaphore Sample
Description
This sample is designed to demonstrate the usage and abilities of the FastSemaphore functions. The sample contains the following features:
- Uses a FastSemaphore as a binary semaphore, acquiring and releasing the FastSemaphore from different threads.
- Uses the main thread to control FastSemaphore access to run 1 child thread at a time.
- Uses the main thread to control FastSemaphore access to run all children threads.
Source Files
File | Description |
---|---|
FastSemaphore.h | Header file. |
FastSemaphore.c | Source file. |
FastSemaphore_VS<Visual Studio version>.vcxproj | Project file for supported versions of Visual Studio. |
FastSemaphore_VS<Visual Studio version>.sln | Solution file for supported versions of Visual Studio. |
Building the Sample
- Open a solution file in the corresponding Visual Studio version you are using for development.
- Build the solution.
Running the Sample
You can run the sample using RtssRun:
Rtssrun <build-path>\FastSemaphore.rtss
Remarks
This sample supports these configurations:
- RTSSDebug(x64)
- RTSSRelease(x64)
This sample requires at least two processors assigned to RTX64 and configured.
APIs Referenced
RTAPI
- RtGetProcessAffinityMask
- RtSetThreadPriority
- RtInitializeFastSemaphore
- RtAcquireFastSemaphore
- RtReleaseFastSemaphore
- RtReleaseAllFastSemaphore
- RtQueryPerformanceCounter
- RtQueryPerformanceFrequency
- RtGenerateEvent
- RtPrintf
Supported Windows API