[omniORB] pthreads for solaris, linux ... mach?

Gary D. Duzan gdd0@gte.com
Fri, 17 Nov 2000 10:53:48 -0500


   I've seen this before, but I forget exactly what the cause was.
I think some systems have trouble throwing exceptions out of a
destructor. It may also be a problem if you are already executing
in an environment called from an exception handler.
   To debug the actual problem, though, you might try running in
a debugger with a breakpoint in the constructor for omni_thread_fatal.
At this point the errno is a parameter to the constructor, so you
can see what caused the exception in the first place.

					Gary Duzan
					Verizon Laboratories



In Message <4B68A8D2B880D311BCB70090278CBF621F7CCD@cordelia> ,
   "ERIKSSON,TOBIAS (A-Sweden,ex1)" <tobias_eriksson@agilent.com> wrote:

=>Thanx Gary,
=> Although, there is something strange, if I put a try{ }catch(...){}
=>around my delete of the mutex, it does not pick up the exception.
=>e.g.
=>
=>try
=>{
=>	if( myMutex )
=>	{
=>		delete myMutex;
=>		myMutex=NULL;
=>	}
=>}
=>catch(...)
=>{
=>	cerr << "Woops! and exception." << endl;
=>}
=>
=>I never get this far, the application ends with stacktrace below anyway.
=>How can this be?
=>
=>Regards
=> Tobias
=>
=>
=>-----Original Message-----
=>From: Gary D. Duzan [mailto:gdd0@gte.com]
=>Sent: den 17 november 2000 16:27
=>To: ERIKSSON,TOBIAS (A-Sweden,ex1)
=>Cc: omniorb-list@uk.research.att.com
=>Subject: Re: [omniORB] pthreads for solaris, linux ... mach? 
=>
=>
=>   If you look at the source for posix.cc again, you'll see that
=>THROW_ERRORS() is a macro which checks the return value of its
=>argument and throws an exception if it returned an error.
=>
=>					Gary Duzan
=>					Verizon Laboratories
=>
=>
=>
=>In Message <4B68A8D2B880D311BCB70090278CBF621F7CCC@cordelia> ,
=>   "ERIKSSON,TOBIAS (A-Sweden,ex1)" <tobias_eriksson@agilent.com> wrote:
=>
=>=>Hi
=>=> I had an error in my application and started to go through the
=>stacktrace,
=>=>it came down to a method called ~omni_mutex(), I tried to look it up and
=>=>found out that there were a couple of files to choose from containing the
=>=>destructor ~omni_mutex(). There are :
=>=>	mach.cc
=>=>	nt.cc
=>=>	posix.cc
=>=>	solaris.cc
=>=>I guess that Linux (debian or Redhat) uses the posix.cc, is that correct?
=>=>
=>=>If I look in that one there is only one line, and it says something like
=>=>this:
=>=>	THROW_ERRORS(pthread_mutex_destroy(...
=>=>
=>=>This method exists in /usr/include/pthread.h, but is as I understand a
=>C-lib
=>=>method.
=>=>In my stacktrace, below, that method pthread_mutex_destroy() is not in the
=>=>stacktrace, and if is but isn't shown then it throws an exception, how is
=>=>that possible from a C-lib?
=>=>And how can a mutex raise an exception?
=>=>
=>=>#0  0x401a3931 in kill () from /lib/libc.so.6
=>=>#1  0x40020ee9 in pthread_kill () from /lib/libpthread.so.0
=>=>#2  0x40021365 in raise () from /lib/libpthread.so.0
=>=>#3  0x401a4d28 in abort () from /lib/libc.so.6
=>=>#4  0x40146f58 in __terminate () from /usr/lib/libstdc++-libc6.1-2.so.3
=>=>#5  0x40146f75 in __terminate () from /usr/lib/libstdc++-libc6.1-2.so.3
=>=>#6  0x40147af4 in __throw () from /usr/lib/libstdc++-libc6.1-2.so.3
=>=>#7  0x4011f151 in omni_mutex::~omni_mutex ()
=>=>.
=>=>.
=>=>.
=>=>
=>=>I don't understand how this works, could someone help me out. 
=>=>
=>=>Regards 
=>=> Tobias
=>=>
=>=>