Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
threads.h File Reference
#include "stdbool.h"
#include "modules/core/threads_arch.h"
#include "stdint.h"
#include <stddef.h>
+ Include dependency graph for threads.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct pprzMutex pprz_mutex_t
 
typedef struct pprzBSem pprz_bsem_t
 

Functions

int pprz_mtx_init (pprz_mutex_t *mtx)
 
int pprz_mtx_lock (pprz_mutex_t *mtx)
 
int pprz_mtx_trylock (pprz_mutex_t *mtx)
 Performs a nonblocking lock on the mutex.
 
int pprz_mtx_unlock (pprz_mutex_t *mtx)
 
void pprz_bsem_init (pprz_bsem_t *bsem, bool taken)
 
void pprz_bsem_wait (pprz_bsem_t *bsem)
 
void pprz_bsem_signal (pprz_bsem_t *bsem)
 
int pprz_thread_create (pprz_thread_t *thread, size_t size, const char *name, uint8_t prio, void(*func)(void *), void *arg) THREADS_ATTRIBUTES
 Creates a new thread whose stack is dynamically allocated.
 
void pprz_thread_exit (void *retval) THREADS_ATTRIBUTES
 Exit the current thread.
 
int pprz_thread_join (pprz_thread_t *thread, void **retval) THREADS_ATTRIBUTES
 Wait for the thread to terminate.
 
int pprz_thread_tryjoin (pprz_thread_t *thread, void **retval) THREADS_ATTRIBUTES
 Performs a nonblocking join with the thread.
 

Typedef Documentation

◆ pprz_bsem_t

Definition at line 22 of file threads.h.

◆ pprz_mutex_t

Definition at line 21 of file threads.h.

Function Documentation

◆ pprz_bsem_init()

void pprz_bsem_init ( pprz_bsem_t bsem,
bool  taken 
)

Definition at line 39 of file threads_arch.c.

References pprzBSem::bsem, bsem, foo, pprzBSem::mtx, pprzBSem::sem, and pprzBSem::value.

Referenced by thd_test_init().

+ Here is the caller graph for this function:

◆ pprz_bsem_signal()

void pprz_bsem_signal ( pprz_bsem_t bsem)

Definition at line 47 of file threads_arch.c.

References pprzBSem::bsem, bsem, foo, pprzBSem::mtx, pprzBSem::sem, val, and pprzBSem::value.

Referenced by thd_test_periodic().

+ Here is the caller graph for this function:

◆ pprz_bsem_wait()

void pprz_bsem_wait ( pprz_bsem_t bsem)

Definition at line 43 of file threads_arch.c.

References pprzBSem::bsem, bsem, foo, pprzBSem::sem, and pprzBSem::value.

Referenced by test_thd().

+ Here is the caller graph for this function:

◆ pprz_mtx_init()

int pprz_mtx_init ( pprz_mutex_t mtx)

Definition at line 18 of file threads_arch.c.

References foo, pprzMutex::mtx, and mtx.

Referenced by copilot_init(), gec_transport_init(), slcan_init(), syslink_dl_init(), and thd_test_init().

+ Here is the caller graph for this function:

◆ pprz_mtx_lock()

◆ pprz_mtx_trylock()

int pprz_mtx_trylock ( pprz_mutex_t mtx)

Performs a nonblocking lock on the mutex.

Returns
0 if successful

Definition at line 28 of file threads_arch.c.

References foo, pprzMutex::mtx, and mtx.

Referenced by thd_test_periodic(), and thd_test_syracuse_restart().

+ Here is the caller graph for this function:

◆ pprz_mtx_unlock()

◆ pprz_thread_create()

int pprz_thread_create ( pprz_thread_t thread,
size_t  size,
const char name,
uint8_t  prio,
void(*)(void *)  func,
void arg 
)

Creates a new thread whose stack is dynamically allocated.

Parameters
[in]sizesize of the stack. Unused on linux at the moment.
[in]priothe priority level for the new thread. Unused on linux at the moment. NORMALPRIO
[in]pfthe thread function
[in]argan argument passed to the thread function. It can be NULL.
[out]threadpointer to a pprz_thread_t that will be writen with the handle to the thread
Returns
Return 0 on success, or a platform dependant error code.

@api

Definition at line 52 of file threads_arch.c.

References stub_arg::arg, foo, stub_arg::func, and stub().

Referenced by thd_test_init(), and thd_test_syracuse_restart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pprz_thread_exit()

void pprz_thread_exit ( void retval)

Exit the current thread.

Parameters
[out]retvalThe thread's return value

Definition at line 60 of file threads_arch.c.

References foo.

Referenced by test_thd().

+ Here is the caller graph for this function:

◆ pprz_thread_join()

int pprz_thread_join ( pprz_thread_t thread,
void **  retval 
)

Wait for the thread to terminate.

Note
Warning ! This is a blocking function, do not use it in the main AP thread !
Parameters
[in]threadThe thread to be joined
[out]retvalThe thread's return value will be written to the variable pointed by retval

Definition at line 65 of file threads_arch.c.

References foo.

Referenced by pprz_thread_tryjoin().

+ Here is the caller graph for this function:

◆ pprz_thread_tryjoin()

int pprz_thread_tryjoin ( pprz_thread_t thread,
void **  retval 
)

Performs a nonblocking join with the thread.

Parameters
[in]threadThe thread to be joined
[out]retvalThe thread's return value will be written to the variable pointed by retval. must not be used if this fuction did not returned 0.
Returns
0 if the thread successfully joined.

Definition at line 71 of file threads_arch.c.

References foo, and pprz_thread_join().

Referenced by thd_test_periodic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: