framework/c/inc/le_semaphore.h File Reference

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)
le_sem_Ref_t le_sem_CreateTraceable (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)
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. 2014. All rights reserved. Use of this work is subject to license.


Typedef Documentation

typedef struct le_sem_t* le_sem_Ref_t

Reference to Semaphore structure.


Function Documentation

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]nameName of the semaphore.
[in]initialCountInitial number of semaphore.
le_sem_Ref_t le_sem_CreateTraceable ( const char *  name,
int32_t  initialCount 
)

Create a traceable 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]nameName of the semaphore.
[in]initialCountInitial number of semaphore.
void le_sem_Delete ( le_sem_Ref_t  semaphorePtr)

Delete a semaphore.

Parameters:
[in]semaphorePtrPointer to the semaphore.
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]nameName of the semaphore.
int le_sem_GetValue ( le_sem_Ref_t  semaphorePtr)

Get the value of a semaphore.

Returns:
value of the semaphore
Parameters:
[in]semaphorePtrPointer to the semaphore.
void le_sem_Post ( le_sem_Ref_t  semaphorePtr)

Post a semaphore.

Returns:
Nothing.
Parameters:
[in]semaphorePtrPointer to the semaphore.

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]semaphorePtrPointer to the semaphore.
void le_sem_Wait ( le_sem_Ref_t  semaphorePtr)

Wait for a semaphore.

Returns:
Nothing.
Parameters:
[in]semaphorePtrPointer to the semaphore.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines