Go to the source code of this file.
Typedefs | |
typedef struct le_sem_t * | le_sem_Ref_t |
Functions | |
le_sem_Ref_t | le_sem_Create (const char *name, int32_t initialCount) |
void | le_sem_Delete (le_sem_Ref_t semaphorePtr) |
le_sem_Ref_t | le_sem_FindSemaphore (const char *name) |
void | le_sem_Wait (le_sem_Ref_t semaphorePtr) |
le_result_t | le_sem_TryWait (le_sem_Ref_t semaphorePtr) |
le_result_t | le_sem_WaitWithTimeOut (le_sem_Ref_t semaphorePtr, le_clk_Time_t timeToWait) |
void | le_sem_Post (le_sem_Ref_t semaphorePtr) |
int | le_sem_GetValue (le_sem_Ref_t semaphorePtr) |
Detailed Description
Legato Semaphore API include file.
Copyright (C) Sierra Wireless Inc.
Typedef Documentation
◆ le_sem_Ref_t
typedef struct le_sem_t* le_sem_Ref_t |
Reference to Semaphore structure.
Function Documentation
◆ le_sem_Create()
le_sem_Ref_t le_sem_Create | ( | const char * | name, |
int32_t | initialCount | ||
) |
Create a semaphore shared by threads within the same process.
- Note
- Terminates the process on failure, no need to check the return value for errors.
- Parameters
-
[in] name Name of the semaphore. [in] initialCount Initial number of semaphore.
◆ le_sem_Delete()
void le_sem_Delete | ( | le_sem_Ref_t | semaphorePtr | ) |
Delete a semaphore.
- Parameters
-
[in] semaphorePtr Pointer to the semaphore.
◆ le_sem_FindSemaphore()
le_sem_Ref_t le_sem_FindSemaphore | ( | const char * | name | ) |
Finds a specified semaphore's name.
- Returns
- Reference to the semaphore, or NULL if the semaphore doesn't exist.
- Parameters
-
[in] name Name of the semaphore.
◆ le_sem_GetValue()
int le_sem_GetValue | ( | le_sem_Ref_t | semaphorePtr | ) |
Get the value of a semaphore.
- Returns
- value of the semaphore
- Parameters
-
[in] semaphorePtr Pointer to the semaphore.
◆ le_sem_Post()
void le_sem_Post | ( | le_sem_Ref_t | semaphorePtr | ) |
Post a semaphore.
- Returns
- Nothing.
- Parameters
-
[in] semaphorePtr Pointer to the semaphore.
◆ le_sem_TryWait()
le_result_t le_sem_TryWait | ( | le_sem_Ref_t | semaphorePtr | ) |
Try to wait for a semaphore.
It's the same as le_sem_Wait, except if it can't be immediately performed, then returns an LE_WOULD_BLOCK instead of blocking it.
- Returns
- Upon successful completion, returns LE_OK (0), otherwise it returns LE_WOULD_BLOCK as the call would block if it was a blocking call.
- Parameters
-
[in] semaphorePtr Pointer to the semaphore.
◆ le_sem_Wait()
void le_sem_Wait | ( | le_sem_Ref_t | semaphorePtr | ) |
Wait for a semaphore.
- Returns
- Nothing.
- Parameters
-
[in] semaphorePtr Pointer to the semaphore.
◆ le_sem_WaitWithTimeOut()
le_result_t le_sem_WaitWithTimeOut | ( | le_sem_Ref_t | semaphorePtr, |
le_clk_Time_t | timeToWait | ||
) |
Wait for a semaphore with a limit on how long to wait.
- Returns
- LE_OK The function succeed
- LE_TIMEOUT timeToWait elapsed
- Note
- When LE_TIMEOUT occurs the semaphore is not decremented.
- Parameters
-
[in] semaphorePtr Pointer to the semaphore. [in] timeToWait Time to wait