3 #include "pico/stdlib.h"
17 sem_init(&sem, initalPermits,maxPermits);
27 return sem_available(&sem);
32 sem_reset(&sem, permits);
39 sem_acquire_blocking(&sem);
42 result = sem_acquire_timeout_ms(&sem, timeoutMs);
49 return sem_release(&sem);
Pico Semaphore which might be useful if you use the 2 processors (e.g. with the Thread class)
Definition: PicoSemaphore.h:13
bool signal()
identical with release
Definition: PicoSemaphore.h:68
bool release()
release the semaphore and makes it availale for other processes
Definition: PicoSemaphore.h:48
Semaphore(int maxPermits=1, int initalPermits=1)
constructor - calls sem_init
Definition: PicoSemaphore.h:16
bool down()
identical with release
Definition: PicoSemaphore.h:58
int available()
checks if a semaphore is available
Definition: PicoSemaphore.h:26
~Semaphore()
descructor - calls sem_release
Definition: PicoSemaphore.h:21
bool aquire(int64_t timeoutMs=-1)
aquires a semaphore - if no time is indicated it is blocking
Definition: PicoSemaphore.h:36
bool up()
identical with aquire
Definition: PicoSemaphore.h:53
void reset(int permits=1)
calls sem_reset
Definition: PicoSemaphore.h:31
bool wait()
identical with aquire
Definition: PicoSemaphore.h:63
Pico Arduino Framework.
Definition: Arduino.cpp:26