Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

test_diners.cxx File Reference

#include "pandabase.h"
#include "thread.h"
#include "conditionVar.h"
#include "mutexHolder.h"
#include "pointerTo.h"

Go to the source code of this file.

Compounds

class  philosopher

Defines

#define PRINTMSG(x)   { MutexHolder l(print_mutex); x; }
#define N_DINERS   5

Functions

double random_f (double max)
 PT (philosopher) phils[N_DINERS]
int main (int, char **)

Variables

Mutex rand_mutex
Mutex print_mutex
Mutex chopsticks [N_DINERS]
Mutex room_mutex
ConditionVar room_condition (room_mutex)
int room_occupancy = 0


Define Documentation

#define N_DINERS   5
 

Definition at line 51 of file test_diners.cxx.

Referenced by main(), and philosopher::thread_main().

#define PRINTMSG x   )     { MutexHolder l(print_mutex); x; }
 

Definition at line 47 of file test_diners.cxx.

Referenced by main(), and philosopher::thread_main().


Function Documentation

int main int  ,
char ** 
 

Definition at line 116 of file test_diners.cxx.

References Mutex::lock(), N_DINERS, Thread::prepare_for_exit(), PRINTMSG, Mutex::release(), room_condition, room_mutex, room_occupancy, Thread::sleep(), TP_normal, and ConditionVar::wait().

PT philosopher   ) 
 

double random_f double  max  )  [static]
 

Definition at line 35 of file test_diners.cxx.

References rand_mutex.

Referenced by philosopher::thread_main().


Variable Documentation

Mutex chopsticks[N_DINERS]
 

Definition at line 53 of file test_diners.cxx.

Referenced by philosopher::thread_main().

Mutex print_mutex
 

Definition at line 45 of file test_diners.cxx.

Mutex rand_mutex
 

Definition at line 33 of file test_diners.cxx.

Referenced by random_f(), and philosopher::thread_main().

ConditionVar room_condition(room_mutex)
 

Referenced by main(), and philosopher::thread_main().

Mutex room_mutex
 

Definition at line 59 of file test_diners.cxx.

Referenced by main(), and philosopher::thread_main().

int room_occupancy = 0
 

Definition at line 62 of file test_diners.cxx.

Referenced by main(), and philosopher::thread_main().


Generated on Fri Apr 18 00:11:03 2003 for Panda by doxygen1.3