#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <iostream>
#include <typeinfo>
#include <rpa/synchro.h>
#include <rpa/adapters/thread_fast.h>
#include <rpa/adapters/thread_exec_lock.h>
#include <rpa/adapters/thread_repair.h>
#include <rpa/adapters/thread_replace.h>
#include <rpa/architectures/posix.h>
Classes | |
struct | FuncLockSingleType< Mtx > |
Defines | |
#define | NB_THR 2 |
#define | NB_LOOP ( 2 * TST_RATIO ) |
The constant TST_RATIO allows to adjust the tests duration. | |
Functions | |
static void | sleepzero (int n) |
static void * | FuncCheckWrite (void *aData) |
Simple function writing into a char string, to be sure that it was called. | |
template<class Thr> | |
void | TstThrCheckWrite (int aNbSecs, Thr &myThread) |
template<class Thr, class Mtx> | |
void | TstThrLockSingle (int aNbSecs) |
Creates several threads that will lock the same mutex. | |
template<class Thr> | |
void | TstThrLock (int aNbSecs, Thr &myThread) |
One try per mutex type. | |
template<class Thr> | |
void | TstThrAll (int aNbSecs, Thr &myThread) |
template<class Thr> | |
void | TstThr (int aNbSecs) |
template<class Thr> | |
void | TstThrFast (int aNbSecs) |
template<class Thr> | |
void | TstThrExecLock (int aNbSecs) |
static void | TstThrSecs (int aNbSecs) |
Chases race-conditions, so changes delays. | |
int | main (int aArgC, const char **aArgV) |
Variables | |
static char | Witness [2048] |
To check that the thread was correctly called. | |
static const char * | myEmpty = "Empty string" |
volatile int | WitnessInt |
#define NB_LOOP ( 2 * TST_RATIO ) |
The constant TST_RATIO allows to adjust the tests duration.
#define NB_THR 2 |
static void* FuncCheckWrite | ( | void * | aData | ) | [static] |
Simple function writing into a char string, to be sure that it was called.
int main | ( | int | aArgC, | |
const char ** | aArgV | |||
) |
static void sleepzero | ( | int | n | ) | [static] |
void TstThr | ( | int | aNbSecs | ) |
void TstThrAll | ( | int | aNbSecs, | |
Thr & | myThread | |||
) |
void TstThrCheckWrite | ( | int | aNbSecs, | |
Thr & | myThread | |||
) |
Tests any thread type, for a given tempo. We simply check that the thread was actually created.
void TstThrExecLock | ( | int | aNbSecs | ) |
Same but with the thread adapter 'thread_exec_lock'. The results must be functionaly the same.
Does not work for the moment .....
void TstThrFast | ( | int | aNbSecs | ) |
Same but with the thread adapter 'thread_fast'. The results must be functionaly the same.
void TstThrLock | ( | int | aNbSecs, | |
Thr & | myThread | |||
) |
One try per mutex type.
void TstThrLockSingle | ( | int | aNbSecs | ) |
Creates several threads that will lock the same mutex.
static void TstThrSecs | ( | int | aNbSecs | ) | [static] |
Chases race-conditions, so changes delays.
const char* myEmpty = "Empty string" [static] |
char Witness[2048] [static] |
To check that the thread was correctly called.
volatile int WitnessInt |
For a given type of thread, and a given type of mutex, checks that it is possible to lock the sub-thread with the mutex.