PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
sem.h File Reference
#include <pbl/kernel/types.h>

Data Structures

struct  pbl_sem
 Counting semaphore. More...
 

Macros

#define PBL_SEM_INITIALIZER(init, lim)    {.initial = (init), .limit = (lim), .backend = PBL_SEM_BACKEND_INITIALIZER(init)}
 Static initializer for a semaphore.
 
#define PBL_SEM_DEFINE(name, initial, limit)    struct pbl_sem name = PBL_SEM_INITIALIZER(initial, limit)
 Define a semaphore, usable without pbl_sem_init().
 

Functions

void pbl_sem_init (struct pbl_sem *s, uint32_t initial, uint32_t limit)
 Initialize a semaphore in dynamically allocated memory.
 
void pbl_sem_deinit (struct pbl_sem *s)
 Release a semaphore before its memory is reused.
 
int pbl_sem_take (struct pbl_sem *s, pbl_timeout_t timeout)
 Take a token.
 
void pbl_sem_give (struct pbl_sem *s)
 Give a token.
 
void pbl_sem_reset (struct pbl_sem *s)
 Set the count back to its initial value.
 
uint32_t pbl_sem_count (const struct pbl_sem *s)
 Get the current count.