Re: X3 thread-safety

Igor R <[email protected]> Wed, 26 Dec 2018 09:23:31 +0200
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <CAPnv1P+TpYFRFJcLW22ndefR35sUthSEPd7fF4GP9ykms+raXw@mail.gmail.com>
> > Before I begin to debug it in depth, I'd like to know if there's some
> > known issue with Spirit's thread-safety in Boost 1.68.
>
> X3's thread safety is inherently higher than Qi's because rules have no
> state and also the proto expression trees don't nearly hold as many
> references by default (move-semantics are employed to have "perfect
> storage").
>
> I'd look at other causes.

I've solved this problem. It was a mix of a behavior change in X3 and
my wrong assumptions.
In earlier X3 versions with<tag>(obj) used to copy obj - it was not
properly forwarded to with_value_holder. In my code I used to pass
namespace-scoped objects to with<>, relying on the fact that they
would be copied anyway.
But in the new version obj is taken by reference and forwarded to
with_value_holder!
To fix the bug, now I have to pass to with<> prvalues only, like this:
with<my_tag>(my_obj_type{my_obj}) - so that "obj" goes to the
value-holding with_value_holder specialization.