Synchronizing native threads with semaphore at Android NDK
We have covered mutex, conditional variables, and reader/writer lock in the previous three recipes. This is the last recipe on threads synchronization at Android NDK, and we will discuss semaphores.
Getting ready...
Readers are expected to read through the previous three recipes, Synchronizing native threads with mutex at Android NDK, Synchronizing native threads with conditional variables at Android NDK, and Synchronizing native threads with reader/writer locks at Android NDK, before this one.
How to do it...
The following steps will help you create an Android project that demonstrates the usage of pthread reader/writer lock:
- Create an Android application named
NativeThreadsSemaphore
. Set ...
Get Android Native Development Kit Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.