[MOAB-dev] thread safety

Grindeanu, Iulian R. iulian at mcs.anl.gov
Fri Oct 3 14:06:34 CDT 2014


________________________________
From: Grindeanu, Iulian R.
Sent: Friday, October 03, 2014 2:05 PM
To: Lorenzo Alessio Botti
Subject: RE: [MOAB-dev] thread safety

yes, seq would be filled by multiple threads
(this is simplified, there are other local variables in this method tag_get_data, there are several cascading calls to get to actual getting/setting the tag)

I am not sure I understand what you try to say.
Are you suggesting to use another class/structure ?

an *_iterate example is here:
http://ftp.mcs.anl.gov/pub/fathom/moab-docs/DirectAccessNoHoles_8cpp-example.html

basically, you get a pointer in memory (if contiguous) for every tag, or connectivity array

These *_iterate calls should be made in a loop if the sequences are broken
http://ftp.mcs.anl.gov/pub/fathom/moab-docs/classmoab_1_1Interface.html#ae287e8e24aefae7b16902affe185fae8

Hope this helps.

Iulian

________________________________
From: Lorenzo Alessio Botti [bottilorenzo at gmail.com]
Sent: Friday, October 03, 2014 1:54 PM
To: Grindeanu, Iulian R.
Subject: Re: [MOAB-dev] thread safety

Iulian, I don’t understand why this code is not thread safe

  get_tag_data (entity, *value)
{
    SequenceData  * seq = find_sequence(entity)
    *value = seq->value_for_entity(entity)
}

While the following is not thread safe because different threads would try to fill seq at the same time.
some class
{
    SequenceData  * seq;
    get_tag_data (entity, *value)
   {
        seq = find_sequence(entity)
      *value = seq->value_for_entity(entity)
   }
};

I am missing something?

How can I use *_iterate methods? Can you please show me or point me to an example.
Thanks a lot.
Lorenzo


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/moab-dev/attachments/20141003/7b010165/attachment.html>


More information about the moab-dev mailing list