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:

  1. Create an Android application named NativeThreadsSemaphore. Set ...

Get Android Native Development Kit Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.