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

C:/temp/src/j2k/Test/Basic_Test.cpp

Go to the documentation of this file.
00001 #include <j2k/Fred/Standard.hpp>
00002 #include <j2k/Fred/Error/JError.cpp>
00003 #include <j2k/445/Posix/Basic_PThread.cpp>
00004 #include <j2k/445/Posix/Mutex.cpp>
00005 
00006 #define MAX  10000
00007 
00008 Mutex ml;
00009 int p = 100;
00010 
00011 class Fred : public Basic_PThread 
00012 {
00013 public:
00014    Fred( char* n = ".", int a = 0 ) : Basic_PThread(), s( n ) { } 
00015 
00016    virtual void run() {
00017    for(;;) {
00018            ml.lock();
00019            printf("%s", s);
00020       ml.unlock();
00021 //           sched_yield();
00022    }
00023    } 
00024 
00025    char* s;
00026    int   amount;
00027 };
00028 
00029 int main( int argc = 0, char* argv[] = NULL) 
00030 {
00031   Fred*  t1 = new Fred( "0",  10 );
00032   Fred*  t2 = new Fred( "1", -20 );
00033   Fred*  t3 = new Fred( "2", -20 );
00034   Fred*  t4 = new Fred( "3", -20 );
00035   Fred*  t5 = new Fred( "4", -20 );
00036 
00037   t1->start();
00038   t2->start();
00039   t3->start();
00040   t4->start();
00041   t5->start();
00042 
00043   printf("t1-5 started.\n\n");
00044 
00045   int max = MAX;
00046 
00047   if ( argc > 0 ) {
00048     printf("max = %s", argv[1] );
00049     max = atoi( argv[1] );
00050     if ( max < 10 ) max = MAX;
00051   } 
00052 
00053   for( int i = 0; i < max; i++ ) { 
00054    printf( "." );
00055 //   sched_yield();
00056   }
00057 
00058   return 0;
00059 }

Generated on Sun Oct 14 18:46:21 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001