Ok. Thanks Matt. For the tests I have run so far, my simple fix of removing all the static vars from OsiCpx seems to have worked. However, my usage for this case is very simple. I am essentially just solving the same N models on T threads over and over again with just a minor problem modifications. So, I think the thread-safey in my case is primarly cplex&#39;s - which we know that part is fine. The main &quot;connector&quot; through OSI seems to be the env_, lp_ vars - of which env_ was static.<br>

<br>I&#39;ll definitely keep my eye out for other issues and I&#39;ll let you know / add tickets.<br><br>Thanks,<br>Matt G<br><br><br><div class="gmail_quote"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Matt-<br>
<br>
I&#39;m not sure that thread safety is quite that simple.  You may have<br>
eliminated some of the obvious races, but it wouldn&#39;t surprise me to<br>
find other hidden ones that don&#39;t crop up as frequently.  OSI really<br>
needs a more comprehensive audit for thread safety, which we are aware<br>
of and which is on my agenda.<br>
<br>
If you have patches that you think make a good starting point, I&#39;m glad<br>
to have them.  The best place to keep them is probably attached to a<br>
ticket.<br>
<br>
Thanks.<br>
<br>
                Matt<br>
<div><div></div><div class="h5"><br>
<br>
<br>
On Fri, 2009-08-28 at 01:57 -0400, Matthew Galati wrote:<br>
&gt; FYI. If I remove all the references to static env_, version, etc...<br>
&gt; things seem to work fine now. OsiCpx is then thread-safe.<br>
&gt;<br>
&gt; Can this be changed? or at least provided as an option? It is a shame<br>
&gt; if one cannot use Osi in a multi-threaded environment.<br>
&gt; ________________________________________<br>
&gt; From: <a href="mailto:osi-bounces@list.coin-or.org">osi-bounces@list.coin-or.org</a> [<a href="mailto:osi-bounces@list.coin-or.org">osi-bounces@list.coin-or.org</a>] On<br>
&gt; Behalf Of Matthew Galati [<a href="mailto:magh@lehigh.edu">magh@lehigh.edu</a>]<br>
&gt; Sent: Thursday, August 27, 2009 11:55 PM<br>
&gt; To: <a href="mailto:osi@list.coin-or.org">osi@list.coin-or.org</a><br>
&gt; Subject: [Osi] osicpx threaded<br>
&gt;<br>
&gt; Has anyone successfully used more than one instance/thread of OsiCpx<br>
&gt; simultaneously? I am trying to do this. Constructing 2 instances of<br>
&gt; OsiCpx and using standard pthreads, solve two MILPs on 2 threads. It<br>
&gt; crashes. Valgrind/Helgrind is showing lots of potential race<br>
&gt; conditions. Looking a little deeper into OsiCpx, I noticed that<br>
&gt; although I have two different CpxLp ptrs, I have one CpxEnv ptr. In<br>
&gt; fact, the cpx env is a static variable in OsiCpx. Doesn&#39;t this make<br>
&gt; OsiCpx not thread-safe? Is there any easy way around this?<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Matt<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; Osi mailing list<br>
&gt; <a href="mailto:Osi@list.coin-or.org">Osi@list.coin-or.org</a><br>
&gt; <a href="http://list.coin-or.org/mailman/listinfo/osi" target="_blank">http://list.coin-or.org/mailman/listinfo/osi</a><br>
<font color="#888888">--<br>
                Matthew Saltzman<br>
<br>
Clemson University Math Sciences<br>
mjs AT clemson DOT edu<br>
<a href="http://www.math.clemson.edu/%7Emjs" target="_blank">http://www.math.clemson.edu/~mjs</a><br>
</font></blockquote></div><br>