#include <j2k/Fred/Standard.hpp>#include <j2k/nto/Basic_PThread.hpp>#include <j2k/nto/Mutex.hpp>#include <j2k/nto/RWLock.hpp>Go to the source code of this file.
Compounds | |
| class | Fred |
| class | Reader |
Defines | |
| #define | MAX 100000 |
Functions | |
| int | main (int argc=0, char *argv[]=NULL) |
Variables | |
| RWLock | r |
| long | p = 100 |
|
|
Definition at line 6 of file RWLock_Test.cpp. |
|
||||||||||||
|
Definition at line 61 of file RWLock_Test.cpp. 00062 {
00063
00064 // Verify that the Critical Section inside the [CS] (CS) {CS} respectively
00065 // is not interrupted.
00066 // i.e. Simple Mutual exclusion test.
00067
00068 // Example: if you see [( ]) or [()] or ([{]}) or anything alike then the code is not working.
00069 // Perhaps, if you see [](){} or anyother combination, then it works just fine!
00070
00071 Fred* t1 = new Fred( "0", '[', ']' );
00072 Fred* t2 = new Fred( "1", '(', ')' );
00073 Fred* t3 = new Fred( "2", '{', '}' );
00074
00075 Reader* r1 = new Reader( "3", '[', ']' );
00076 Reader* r2 = new Reader( "4", '(', ')' );
00077 Reader* r3 = new Reader( "5", '{', '}' );
00078
00079 t1->start();
00080 t2->start();
00081 t3->start();
00082
00083 r1->start();
00084 r2->start();
00085 r3->start();
00086
00087 printf("t1-2-3 started.\n\n");
00088
00089 int max = MAX;
00090
00091 if ( argc > 1 )
00092 {
00093 printf("max = %s, %d", argv[1], argc );
00094 max = atoi( argv[1] );
00095 if ( max < 10 ) max = MAX;
00096 }
00097
00098 for( int i = 0; i < max; i++ ) {
00099 printf( "." );
00100
00101 // sched_yield();
00102 }
00103
00104 return 0;
00105 }
|
|
|
Definition at line 9 of file RWLock_Test.cpp. |
|
|
Definition at line 8 of file RWLock_Test.cpp. |
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001