RetroArch
Classes | Macros | Typedefs | Functions | Variables
semaphore.c File Reference
#include <stdlib.h>
#include <errno.h>
#include <asm.h>
#include "lwp_sema.h"
#include "lwp_objmgr.h"
#include "lwp_config.h"
#include "semaphore.h"
Include dependency graph for semaphore.c:

Classes

struct  _sema_st
 

Macros

#define LWP_OBJTYPE_SEM   4
 
#define LWP_CHECK_SEM(hndl)
 

Typedefs

typedef struct _sema_st sema_st
 

Functions

void __lwp_sema_init ()
 
static __inline__ sema_st__lwp_sema_open (sem_t sem)
 
static __inline__ void __lwp_sema_free (sema_st *sema)
 
static sema_st__lwp_sema_allocate ()
 
s32 LWP_SemInit (sem_t *sem, u32 start, u32 max)
 Initializes a semaphore. More...
 
s32 LWP_SemWait (sem_t sem)
 Count down semaphore counter and enter lock if counter <=0. More...
 
s32 LWP_SemPost (sem_t sem)
 Count up semaphore counter and release lock if counter >0. More...
 
s32 LWP_SemDestroy (sem_t sem)
 Close and destroy a semaphore, release all threads and handles locked on this semaphore. More...
 

Variables

lwp_objinfo _lwp_sema_objects
 

Macro Definition Documentation

◆ LWP_CHECK_SEM

#define LWP_CHECK_SEM (   hndl)
Value:
{ \
if(((hndl)==LWP_SEM_NULL) || (LWP_OBJTYPE(hndl)!=LWP_OBJTYPE_SEM)) \
return NULL; \
}
#define LWP_OBJTYPE(id)
Definition: lwp_objmgr.h:9
#define NULL
Pointer to 0.
Definition: gctypes.h:65
#define LWP_OBJTYPE_SEM
Definition: semaphore.c:40
#define LWP_SEM_NULL
Definition: semaphore.h:42

◆ LWP_OBJTYPE_SEM

#define LWP_OBJTYPE_SEM   4

Typedef Documentation

◆ sema_st

typedef struct _sema_st sema_st

Function Documentation

◆ __lwp_sema_allocate()

static sema_st* __lwp_sema_allocate ( )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __lwp_sema_free()

static __inline__ void __lwp_sema_free ( sema_st sema)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __lwp_sema_init()

void __lwp_sema_init ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __lwp_sema_open()

static __inline__ sema_st* __lwp_sema_open ( sem_t  sem)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LWP_SemDestroy()

s32 LWP_SemDestroy ( sem_t  sem)

Close and destroy a semaphore, release all threads and handles locked on this semaphore.

Parameters
[in]semhandle to the sem_t structure.
Returns
0 on success, <0 on error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LWP_SemInit()

s32 LWP_SemInit ( sem_t sem,
u32  start,
u32  max 
)

Initializes a semaphore.

Parameters
[out]sempointer to a sem_t handle.
[in]startstart count of the semaphore
[in]maxmaximum count of the semaphore
Returns
0 on success, <0 on error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LWP_SemPost()

s32 LWP_SemPost ( sem_t  sem)

Count up semaphore counter and release lock if counter >0.

Parameters
[in]semhandle to the sem_t structure.
Returns
0 on success, <0 on error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LWP_SemWait()

s32 LWP_SemWait ( sem_t  sem)

Count down semaphore counter and enter lock if counter <=0.

Parameters
[in]semhandle to the sem_t structure.
Returns
0 on success, <0 on error
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ _lwp_sema_objects

lwp_objinfo _lwp_sema_objects