Page MenuHome

Fix threading issues with node ui storage, again...
ClosedPublic

Authored by Jacques Lucke (JacquesLucke) on May 26 2021, 12:35 PM.

Details

Summary

Calling BKE_nodetree_attribute_hint_add from multiple threads still was not safe before..
One issue was that context_map embedded its values directly. So when context_map grows, all NodeUIStorage would move as well.
I could patch around that by using std::unique_ptr in a few places, but that just becomes too complex for now.
Instead I simplified the locking a bit by adding just locking a mutex in NodeTreeUIStorage all the time while an attribute hint is added.

This is not actually much worse performance wise than before, because we did lock a similar mutex before, just for a slightly shorter time.

Going forward it might be a good idea to refactor this a bit more. Maybe the evaluator could remember all the attribute hints and then move them to NodeTreeUIStorage in one go.

Diff Detail

Repository
rB Blender

Event Timeline

Jacques Lucke (JacquesLucke) requested review of this revision.May 26 2021, 12:35 PM
Jacques Lucke (JacquesLucke) created this revision.

Good find. The change makes sense, thanks.

This revision is now accepted and ready to land.May 26 2021, 1:14 PM