<div dir="ltr">Hicham,<br><br>my only concern would be to evaluate how the variant behaves in MT environment. Especially if the implementation uses VTable idiom to avoid additional level of indirection. In that case if you instantiate variants containing the same type from 2 threads at a time it might get into race condition. VTable in Variants was described in the article by Andrei Alexandrescu on how to implement discriminated unions (published in DDJ) and he suggested to use VTable to avoid additional indirection for the sake of performance. <br>
<br>Here are the links:<br><a href="http://www.ddj.com/cpp/184403821">http://www.ddj.com/cpp/184403821</a><br><a href="http://www.ddj.com/cpp/184403828">http://www.ddj.com/cpp/184403828</a><br><a href="http://www.ddj.com/cpp/184403834">http://www.ddj.com/cpp/184403834</a><br>
<br>Would be really interesting to get an answer from developers and a doc statement, on which MT guarantees boost::variant provides.<br><br><br>Best Regards,<br>Ovanes<br> <br><div class="gmail_quote">On Mon, Sep 8, 2008 at 4:48 PM, Steven Watanabe <span dir="ltr">&lt;<a href="mailto:watanabesj@gmail.com">watanabesj@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">AMDG<div class="Ih2E3d"><br>
<br>
Hicham Mouline wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Is the apply_visitor() method per se thread-safe, meaning,<br>
if i have variant object, and i visit it from different threads at same time,<br>
and if i assume the visitor i write is thread-safe, my question is about<br>
the machinery of apply_visitor() itself, is it thread-safe?<br>
 &nbsp;<br>
</blockquote>
<br></div>
The apply_visitor function itself does not modify the<br>
variant in any way, such usage ought to be thread-safe.<br>
<br>
In Christ,<br><font color="#888888">
Steven Watanabe</font><div><div></div><div class="Wj3C7c"><br>
<br>
_______________________________________________<br>
Boost-users mailing list<br>
<a href="mailto:Boost-users@lists.boost.org" target="_blank">Boost-users@lists.boost.org</a><br>
<a href="http://lists.boost.org/mailman/listinfo.cgi/boost-users" target="_blank">http://lists.boost.org/mailman/listinfo.cgi/boost-users</a><br>
</div></div></blockquote></div><br></div>