| 123456789101112131415161718192021222324252627282930313233 | #ifndef WRAPPEDSEMAPHORE_H#define WRAPPEDSEMAPHORE_H#ifdef ESP_PLATFORM#include "freertos/FreeRTOS.h"#include "freertos/semphr.h"#elif __APPLE__#include <dispatch/dispatch.h>#else#include <time.h>#include <semaphore.h>#endifclass WrappedSemaphore{private:#ifdef ESP_PLATFORM    xSemaphoreHandle semaphoreHandle;#elif __APPLE__    dispatch_semaphore_t semaphoreHandle;#else    sem_t semaphoreHandle;#endifpublic:    WrappedSemaphore(int maxVal = 200);    ~WrappedSemaphore();    int wait();    int twait(long milliseconds = 10);    void give();};#endif
 |