[DF] Fix compilation of Foreach with mutable lambdas #8318
[DF] Fix compilation of Foreach with mutable lambdas #8318eguiraud merged 2 commits intoroot-project:masterfrom
Conversation
| TEST(RDataFrameInterface, MutableForeach) | ||
| { | ||
| int i = 0; | ||
| ROOT::RDataFrame(10).Foreach([&](ULong64_t) mutable { ++i; }, {"rdfentry_"}); |
There was a problem hiding this comment.
Doesn't this rely on IMT being off? Maybe better use atomic_int i?
Axel-Naumann
left a comment
There was a problem hiding this comment.
But see comment. I'd really like to tun on IMT by default on Windows and macOS and with X11 outside the grid and batch systems, and this might trigger failures?
|
Starting build on |
yes, and not just here. i don't know how much of our code (and users') relies on the default being single-thread execution, but it's probably a fair amount. having to always think about thread-safety even when doing these sort of quick debugging printouts is not a 100% transparent change. |
|
And for this test you can be certain that no other code in the same test binary turns on IMT? |
|
Yes, the only place that turns on (and then off) IMT in this executable is root/tree/dataframe/test/dataframe_interface.cxx Lines 356 to 364 in 941025d |
|
Merging this. If we want code to be able to never assume implicit MT is off we need a big pass over most RDF code anyway. |
This fixes #8317.