<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style id="owaParaStyle" type="text/css">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1" style="word-wrap:break-word">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;"><br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF765477"><font color="#000000" face="Tahoma" size="2"><b>From:</b> Grindeanu, Iulian R.<br>
<b>Sent:</b> Friday, October 03, 2014 2:05 PM<br>
<b>To:</b> Lorenzo Alessio Botti<br>
<b>Subject:</b> RE: [MOAB-dev] thread safety<br>
</font><br>
</div>
<div></div>
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">yes, seq would be filled by multiple threads<br>
(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)<br>
<br>
I am not sure I understand what you try to say.<br>
Are you suggesting to use another class/structure ?<br>
<br>
an *_iterate example is here:<br>
<a href="http://ftp.mcs.anl.gov/pub/fathom/moab-docs/DirectAccessNoHoles_8cpp-example.html" target="_blank">http://ftp.mcs.anl.gov/pub/fathom/moab-docs/DirectAccessNoHoles_8cpp-example.html</a><br>
<br>
basically, you get a pointer in memory (if contiguous) for every tag, or connectivity array<br>
<br>
These *_iterate calls should be made in a loop if the sequences are broken<br>
<a href="http://ftp.mcs.anl.gov/pub/fathom/moab-docs/classmoab_1_1Interface.html#ae287e8e24aefae7b16902affe185fae8" target="_blank">http://ftp.mcs.anl.gov/pub/fathom/moab-docs/classmoab_1_1Interface.html#ae287e8e24aefae7b16902affe185fae8</a><br>
<br>
Hope this helps.<br>
<br>
Iulian<br>
<br>
<div style="font-family:Times New Roman; color:#000000; font-size:16px">
<hr tabindex="-1">
<div id="divRpF545979" style="direction:ltr"><font color="#000000" face="Tahoma" size="2"><b>From:</b> Lorenzo Alessio Botti [bottilorenzo@gmail.com]<br>
<b>Sent:</b> Friday, October 03, 2014 1:54 PM<br>
<b>To:</b> Grindeanu, Iulian R.<br>
<b>Subject:</b> Re: [MOAB-dev] thread safety<br>
</font><br>
</div>
<div></div>
<div>
<div>Iulian, I don’t understand why this code is not thread safe</div>
<div><br>
</div>
<div>
<blockquote type="cite">
<div style="word-wrap:break-word">
<div style="direction:ltr; font-family:Tahoma; font-size:10pt">  get_tag_data (entity, *value)<br>
{<br>
    SequenceData  * seq = find_sequence(entity)<br>
    *value = seq->value_for_entity(entity)<br>
}</div>
</div>
</blockquote>
<br>
</div>
<div><font face="Tahoma" size="2">While the following is not thread safe because different threads would try to fill seq at the same time.</font></div>
<div><font face="Tahoma" size="2">some class </font></div>
<div><font face="Tahoma" size="2">{</font></div>
<div><span style="font-family:Tahoma; font-size:13px">    SequenceData  * seq; </span></div>
<div><span style="font-family:Tahoma; font-size:13px">    get_tag_data (entity, *value)</span></div>
<div><span style="font-family:Tahoma; font-size:13px">   {</span></div>
<div>        seq <span style="font-family:Tahoma; font-size:13px">= find_sequence(entity)</span></div>
<div><span style="font-family:Tahoma; font-size:13px">      *value = seq->value_for_entity(entity)</span><br style="font-family:Tahoma; font-size:13px">
<span style="font-family:Tahoma; font-size:13px">   }</span></div>
<div><span style="font-family:Tahoma; font-size:13px">};</span></div>
<div><span style="font-family:Tahoma; font-size:13px"><br>
</span></div>
<div><font face="Tahoma" size="2">I am missing something?</font></div>
<div><font face="Tahoma" size="2"><br>
</font></div>
<div><font face="Tahoma" size="2">How can I use *_iterate methods? Can you please show me or point me to an example.</font></div>
<div><font face="Tahoma" size="2">Thanks a lot.</font></div>
<div><font face="Tahoma" size="2">Lorenzo</font></div>
<div><span style="font-family:Tahoma; font-size:13px"><br>
</span></div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>