[Developers] multi-threaded derivative stuff

dave fournier davef at otter-rsch.com
Sun Jul 22 10:49:26 PDT 2012


Hi All,

I recall that at the developers conference over a year ago there was a 
lot of
interest in multi-threading so long as no one actually had to produce 
anything.
It appeared that global variables might be a problem.    I thought it 
might be
of value to produce a proof of concept example with multi-threading for
dvariable types.  The  code runs without any reported errors
(by valgrind) so I think I am getting close.   There are also some 
strange mysteries.

If I write the code as

     master()
     {
         // stuff
         gradient_structure gs(10000)
         // stuff


    }

      slave()
     {
         // stuff
         gradient_structure gs(10000)
         // stuff

    }

There are some obvious problems when the destructor for gs gets called.
But if I write the code as

master()
     {
         // stuff
         gradient_structure * pgs = new gradient_structure(10000)
         // stuff
         delete pgs;
          pgs=0;

    }

      slave()
     {
         // stuff
         gradient_structure * pgs = new gradient_structure(10000)
         // stuff
         delete pgs;
          pgs=0;
    }

all is OK.  So obviously there is something I don't understand or still 
an error in the code.
If anyone is interested I am happy to share the code and the problem. 
I'll hold my
breath.

          Dave



More information about the Developers mailing list