mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2026-03-21 22:09:28 +00:00
33 lines
583 B
C++
33 lines
583 B
C++
#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>
|
|
#endif
|
|
|
|
class WrappedSemaphore
|
|
{
|
|
private:
|
|
#ifdef ESP_PLATFORM
|
|
xSemaphoreHandle semaphoreHandle;
|
|
#elif __APPLE__
|
|
dispatch_semaphore_t semaphoreHandle;
|
|
#else
|
|
sem_t semaphoreHandle;
|
|
#endif
|
|
public:
|
|
WrappedSemaphore(int maxVal = 200);
|
|
~WrappedSemaphore();
|
|
|
|
int wait();
|
|
int twait(long milliseconds = 10);
|
|
void give();
|
|
};
|
|
|
|
#endif |