RetroArch
Classes | Macros | Typedefs | Functions | Variables
lwp.c File Reference
#include <stdlib.h>
#include <errno.h>
#include "asm.h"
#include "processor.h"
#include "lwp_threadq.h"
#include "lwp_threads.h"
#include "lwp_wkspace.h"
#include "lwp_objmgr.h"
#include "lwp_config.h"
#include "lwp.h"
Include dependency graph for lwp.c:

Classes

struct  _tqueue_st
 

Macros

#define LWP_OBJTYPE_THREAD   1
 
#define LWP_OBJTYPE_TQUEUE   2
 
#define LWP_CHECK_THREAD(hndl)
 
#define LWP_CHECK_TQUEUE(hndl)
 

Typedefs

typedef struct _tqueue_st tqueue_st
 

Functions

int __crtmain ()
 
static __inline__ u32 __lwp_priotocore (u32 prio)
 
static __inline__ lwp_cntrl__lwp_cntrl_open (lwp_t thr_id)
 
static __inline__ tqueue_st__lwp_tqueue_open (lwpq_t tqueue)
 
static lwp_cntrl__lwp_cntrl_allocate ()
 
static tqueue_st__lwp_tqueue_allocate ()
 
static __inline__ void __lwp_cntrl_free (lwp_cntrl *thethread)
 
static __inline__ void __lwp_tqueue_free (tqueue_st *tq)
 
static voididle_func (void *arg)
 
void __lwp_sysinit ()
 
BOOL __lwp_thread_isalive (lwp_t thr_id)
 
lwp_t __lwp_thread_currentid ()
 
BOOL __lwp_thread_exists (lwp_t thr_id)
 
frame_context__lwp_thread_context (lwp_t thr_id)
 
s32 LWP_CreateThread (lwp_t *thethread, void *(*entry)(void *), void *arg, void *stackbase, u32 stack_size, u8 prio)
 
s32 LWP_SuspendThread (lwp_t thethread)
 Suspend the given thread. More...
 
s32 LWP_ResumeThread (lwp_t thethread)
 Resume the given thread. More...
 
lwp_t LWP_GetSelf ()
 Return the handle to the current thread. More...
 
void LWP_SetThreadPriority (lwp_t thethread, u32 prio)
 Set the priority of the given thread. More...
 
void LWP_YieldThread ()
 Yield the current thread to another one with higher priority or if not running at the same priority which state is runnable. More...
 
void LWP_Reschedule (u32 prio)
 Reschedule all threads running at the given priority. More...
 
BOOL LWP_ThreadIsSuspended (lwp_t thethread)
 Test whether the given thread is suspended or not. More...
 
s32 LWP_JoinThread (lwp_t thethread, void **value_ptr)
 Join the given thread. More...
 
s32 LWP_InitQueue (lwpq_t *thequeue)
 Initialize the thread synchronization queue. More...
 
void LWP_CloseQueue (lwpq_t thequeue)
 Close the thread synchronization queue and releas the handle. More...
 
s32 LWP_ThreadSleep (lwpq_t thequeue)
 Pushes the current thread onto the given thread synchronization queue and sets the thread state to blocked. More...
 
void LWP_ThreadBroadcast (lwpq_t thequeue)
 Removes all blocked threads from the thread synchronization queue and sets them back to running state. More...
 
void LWP_ThreadSignal (lwpq_t thequeue)
 Signals one thread to be revmoved from the thread synchronization queue and sets it back to running state. More...
 

Variables

lwp_objinfo _lwp_thr_objects
 
lwp_objinfo _lwp_tqueue_objects
 
u8 __stack_addr []
 
u8 __stack_end []
 

Macro Definition Documentation

◆ LWP_CHECK_THREAD

#define LWP_CHECK_THREAD (   hndl)
Value:
{ \
if(((hndl)==LWP_THREAD_NULL) || (LWP_OBJTYPE(hndl)!=LWP_OBJTYPE_THREAD)) \
return NULL; \
}
#define LWP_OBJTYPE(id)
Definition: lwp_objmgr.h:9
#define LWP_OBJTYPE_THREAD
Definition: lwp.c:42
#define NULL
Pointer to 0.
Definition: gctypes.h:65
#define LWP_THREAD_NULL
Definition: lwp.h:51

◆ LWP_CHECK_TQUEUE

#define LWP_CHECK_TQUEUE (   hndl)
Value:
{ \
if(((hndl)==LWP_TQUEUE_NULL) || (LWP_OBJTYPE(hndl)!=LWP_OBJTYPE_TQUEUE)) \
return NULL; \
}
#define LWP_OBJTYPE(id)
Definition: lwp_objmgr.h:9
#define LWP_OBJTYPE_TQUEUE
Definition: lwp.c:43
#define NULL
Pointer to 0.
Definition: gctypes.h:65
#define LWP_TQUEUE_NULL
Definition: lwp.h:52

◆ LWP_OBJTYPE_THREAD

#define LWP_OBJTYPE_THREAD   1

◆ LWP_OBJTYPE_TQUEUE

#define LWP_OBJTYPE_TQUEUE   2

Typedef Documentation

◆ tqueue_st

typedef struct _tqueue_st tqueue_st

Function Documentation

◆ __crtmain()

int __crtmain ( )
Here is the caller graph for this function:

◆ __lwp_cntrl_allocate()

static lwp_cntrl* __lwp_cntrl_allocate ( )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __lwp_cntrl_free()

static __inline__ void __lwp_cntrl_free ( lwp_cntrl thethread)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __lwp_cntrl_open()

static __inline__ lwp_cntrl* __lwp_cntrl_open ( lwp_t  thr_id)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __lwp_priotocore()

static __inline__ u32 __lwp_priotocore ( u32  prio)
static
Here is the caller graph for this function:

◆ __lwp_sysinit()

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

◆ __lwp_thread_context()

frame_context* __lwp_thread_context ( lwp_t  thr_id)
Here is the call graph for this function:

◆ __lwp_thread_currentid()

lwp_t __lwp_thread_currentid ( )

◆ __lwp_thread_exists()

BOOL __lwp_thread_exists ( lwp_t  thr_id)
Here is the call graph for this function:

◆ __lwp_thread_isalive()

BOOL __lwp_thread_isalive ( lwp_t  thr_id)
Here is the call graph for this function:

◆ __lwp_tqueue_allocate()

static tqueue_st* __lwp_tqueue_allocate ( )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __lwp_tqueue_free()

static __inline__ void __lwp_tqueue_free ( tqueue_st tq)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __lwp_tqueue_open()

static __inline__ tqueue_st* __lwp_tqueue_open ( lwpq_t  tqueue)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ idle_func()

static void* idle_func ( void arg)
static
Here is the caller graph for this function:

◆ LWP_CloseQueue()

void LWP_CloseQueue ( lwpq_t  thequeue)

Close the thread synchronization queue and releas the handle.

Parameters
[in]thequeuehandle to the thread's synchronization queue
Returns
none
Here is the call graph for this function:

◆ LWP_CreateThread()

s32 LWP_CreateThread ( lwp_t thethread,
void *(*)(void *)  entry,
void arg,
void stackbase,
u32  stack_size,
u8  prio 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LWP_GetSelf()

lwp_t LWP_GetSelf ( )

Return the handle to the current thread.

Returns
thread context handle
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LWP_InitQueue()

s32 LWP_InitQueue ( lwpq_t thequeue)

Initialize the thread synchronization queue.

Parameters
[in]thequeuepointer to a lwpq_t handle.
Returns
0 on success, <0 on error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LWP_JoinThread()

s32 LWP_JoinThread ( lwp_t  thethread,
void **  value_ptr 
)

Join the given thread.

Parameters
[in]thethreadhandle to the thread's context which should be joined to wait on termination.
[in]value_ptrpointer-pointer to a variable to receive the return code of the terminated thread.
Returns
0 on success, <0 on error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LWP_Reschedule()

void LWP_Reschedule ( u32  prio)

Reschedule all threads running at the given priority.

Parameters
[in]priopriority level to reschedule
Returns
none
Here is the call graph for this function:

◆ LWP_ResumeThread()

s32 LWP_ResumeThread ( lwp_t  thethread)

Resume the given thread.

Parameters
[in]thethreadhandle to the thread context which should be resumed.
Returns
0 on success, <0 on error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LWP_SetThreadPriority()

void LWP_SetThreadPriority ( lwp_t  thethread,
u32  prio 
)

Set the priority of the given thread.

Parameters
[in]thethreadhandle to the thread context whos priority should be changed. If NULL, the current thread will be taken.
[in]prionew priority to set
Returns
none
Here is the call graph for this function:

◆ LWP_SuspendThread()

s32 LWP_SuspendThread ( lwp_t  thethread)

Suspend the given thread.

Parameters
[in]thethreadhandle to the thread context which should be suspended.
Returns
0 on success, <0 on error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LWP_ThreadBroadcast()

void LWP_ThreadBroadcast ( lwpq_t  thequeue)

Removes all blocked threads from the thread synchronization queue and sets them back to running state.

Parameters
[in]thequeuehandle to the thread's synchronization queue to pop the blocked threads off
Returns
none
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LWP_ThreadIsSuspended()

BOOL LWP_ThreadIsSuspended ( lwp_t  thethread)

Test whether the given thread is suspended or not.

Parameters
[in]thethreadhandle to the thread context which should be tested.
Returns
TRUE or FALSE
Here is the call graph for this function:

◆ LWP_ThreadSignal()

void LWP_ThreadSignal ( lwpq_t  thequeue)

Signals one thread to be revmoved from the thread synchronization queue and sets it back to running state.

Parameters
[in]thequeuehandle to the thread's synchronization queue to pop the blocked thread off
Returns
none
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LWP_ThreadSleep()

s32 LWP_ThreadSleep ( lwpq_t  thequeue)

Pushes the current thread onto the given thread synchronization queue and sets the thread state to blocked.

Parameters
[in]thequeuehandle to the thread's synchronization queue to push the thread on
Returns
none
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LWP_YieldThread()

void LWP_YieldThread ( )

Yield the current thread to another one with higher priority or if not running at the same priority which state is runnable.

Returns
none
Here is the call graph for this function:

Variable Documentation

◆ __stack_addr

u8 __stack_addr[]

◆ __stack_end

u8 __stack_end[]

◆ _lwp_thr_objects

lwp_objinfo _lwp_thr_objects

◆ _lwp_tqueue_objects

lwp_objinfo _lwp_tqueue_objects