[Developers] multi-threaded derivative stuff
dave fournier
davef at otter-rsch.com
Sun Jul 22 13:04:42 PDT 2012
On 12-07-22 10:49 AM, dave fournier wrote:
I don't quite understand it but there was some kind of conflict between the
destructor and the code called in at_exit to clean up stuff including
open files.
Making sure the gradient_structure destructor gets called first seems to
fix the problem.
Also the safe_mem versions of mem_malloc and mem_free used in the
string class are not
thread safe. they should be replaced with malloc and free. this all
happens in
string1.cpp which is attached.
> 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
>
> _______________________________________________
> Developers mailing list
> Developers at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/developers
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: string1.cpp
Type: text/x-c++src
Size: 4674 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/developers/attachments/20120722/1e8f3b8b/attachment.cpp>
More information about the Developers
mailing list