M68k C++ Exceptions working!

Joel Sherrill joel.sherrill at OARcorp.com
Fri Jan 14 13:08:33 UTC 2000

Charles-Antoine Gauthier wrote:
> > What do you imagine, is making exceptions not thread safe ?
> > Some description here might to come up with some test cases.
> I don't have it in front of me now, but I seem to recall that the text
> in the gcc source tree that describes the exception processing mechanism
> was quite clear that exception handling was not multithread safe. Global
> variables are used by the low-level exception handling code. If a
> context switch were to occur while the system was looking for an
> exception handler and another exception was raised, good luck when the
> first thread is re-dispatched.
> Use of a per-thread context was described as future work.

Another option ... RTEMS COULD:

  + use the --enable-cplusplus configure option to add this context
    switch to each task.  OR
  + add a per task variable for this but it would have to be registered
    so early in the task life that it would likely require adding a
    C++ specific user extension like the newlib one.

> > I imagine that an exception carring some data, and it been propagated a
> > few levels( 3 or 4 )
> > could be a start for a test. I have put together a test case for that.
> > it seems to run fine on PC386.
> > In a thread safe environment, the data holded by each instance of the
> > exception class should be kept
> > consistent.
> Yes, but that is an application programming problem, IMHO. 

But the tools should work regardless.

> One should
> not 'throw' shared objects around unless it is safe to do that.

That sums up a lot of concurrent programming problems.

> --
> Charles-Antoine Gauthier
> Institute for Information Technology  Institut de technologie de l'information
> National Research Council of Canada   Conseil national de recherches du Canada

Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

More information about the users mailing list