pthread_tst.cpp File Reference

#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 Documentation

#define NB_LOOP   ( 2 * TST_RATIO )

The constant TST_RATIO allows to adjust the tests duration.

#define NB_THR   2


Function Documentation

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]

template<class Thr>
void TstThr ( int  aNbSecs  ) 

template<class Thr>
void TstThrAll ( int  aNbSecs,
Thr &  myThread 
)

template<class Thr>
void TstThrCheckWrite ( int  aNbSecs,
Thr &  myThread 
)

Tests any thread type, for a given tempo. We simply check that the thread was actually created.

template<class Thr>
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 .....

template<class Thr>
void TstThrFast ( int  aNbSecs  ) 

Same but with the thread adapter 'thread_fast'. The results must be functionaly the same.

template<class Thr>
void TstThrLock ( int  aNbSecs,
Thr &  myThread 
)

One try per mutex type.

template<class Thr, class Mtx>
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.


Variable Documentation

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.


Generated on Tue Sep 25 10:20:30 2007 for rpa by  doxygen 1.4.7