Closed ta0kira closed 4 years ago
This might also require changing SourceContext
and CleanupContext
to use ScopedCapture
instead of AutoThreadCrosser
so that tracing doesn't cause a segfault in threads.
Rather than using ThreadCrosser::WrapCall
in the lambda implementation (see #6), a new TraceContext
could be created to copy the previous trace. While potentially inefficient, setting -DDISABLE_TRACING
during C++ compilation would completely eliminate the cost. (There might also need to be a distinction between the "creation trace" and the "execution trace" for lambdas.)
All remaining thread-safety issues in generated code relate to overwriting value references. Since std::shared_ptr
is thread-safe (as far as memory management), this means that race-conditions shouldn't cause undefined behavior, except possibly in hand-written C++ code with persistent C++ state, e.g., std::ostringstream
.
Type
in bothType$create()
andcall<Type>()
.As long as the only object state is data members and static parameters, and (future) lambdas don't use C++ references in closures, everything else should be fine.