[omniORB] Server Shutdown on multi-processor machines

Serguei Kolos Serguei.Kolos at cern.ch
Wed Mar 31 15:38:24 BST 2004


Skipped content of type multipart/alternative-------------- next part --------------
#include <iostream>
#include <pthread.h>
#include <unistd.h>
#include <string>

class Exception
{
    public:
	Exception ( char * t )
         : t_( t )
	{}
    
	const std::string & t() { return t_; }
	
    private:
    
	std::string	t_;
};

void fun_raising_ex( )
{
    throw Exception( "This is just a test exception" );
}

void * fun( void * )
{
  while( 1 )
     try
     {
     	fun_raising_ex( );
     }
     catch( Exception & e )
     {
     	std::cerr << "Thread " << pthread_self() << " has catched exception: " << e.t() << std::endl;
     }
  return 0;
}


int main()
{
    pthread_t t1, t2, t3, t4, t5;
    
    pthread_create( &t1, 0, fun, 0 );
    pthread_create( &t2, 0, fun, 0 );
    pthread_create( &t3, 0, fun, 0 );
    pthread_create( &t4, 0, fun, 0 );
    pthread_create( &t5, 0, fun, 0 );

    sleep( 60 );
        
    return 0;
}


More information about the omniORB-list mailing list