-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dictionary#*(): remove bool overrideFrozen if unused #9658
Conversation
@julianbrost In addition to #9657 I'd like to do the full set of things as in #9627. However for this I have to remove overrideFrozen from these as well, in reverse order:
Removing it from -D would mean I couldn't override (pre-)frozen things even with -D on the command line. Would this be reasonable? |
The command line flag |
Forget this. Proceeding would only be useful if one could freeze ConfigObject#vars. And we can't. Or would you accept the following even more radical change? API modifications of ConfigObject#vars have to internally re-assemble the whole vars dict as it gets frozen. |
So basically copy on write? I've been considering that for namespaces, main issue with that is how do you know when it's safe to delete the old version? If you can't guarantee that there are no concurrent operations, you'd have to ref-count the individual versions. I don't know how this would compare exactly to a rwlock, but it isn't free. |
I would -if you explicitly agree- continue with the following.
|
Which would probably result in use after free bugs.
Which you would also have to do for read operations. Then you can just lock the dictionary instead. |
Just to be clear:
|
Primarily, I'm concerned about introducing undefined behavior, mainly in situations where you might delete the old data while there's still some other thread accessing it. In regarding two writes: well, they have to be sequenced. If one thread adds key A and another thread adds key B, there must not be a situation where the resulting dict only contains one of these keys. If two threads update the same key, the resulting dict may contain either value, unless the threads were synchronized externally.
Please elaborate what you're planning to do. So far I don't see what you want to change so that it results in an improvement and doesn't introduce a bug. |
#9627 has already shown us that not locking at all -if frozen- is faster than read-locking. I want this for ConfigObject#vars -which are frequently accessed by child apply rules- immediately after individual commit. Therefore I have to get rid of ALL overrideFrozen -you said no problem for -D- and to add transparent CoW to ConfigObject#vars. Let's -as 🇷🇺ns say- don't divide the fur of a not killed bear or -in our case- don't worry about not yet introduced bugs, but have a look at the implementation details of the stuff mentioned above once done. OK? |
Either you have an ingenious idea or this might be harder than you think. As you said |
This is exactly my plan. |
Which means you have to track down all references that may be used to modify it. Also, nested dicts could be tricky. Could easily result in a huge changeset. But go ahead and give it a try. |
Sigh. One does not simply un-freeze things and nobody supports atomic smart pointers w/o mutexes. #9657 must be enough. |
What's the goal here now? Doesn't this remove
So what about this part?
Sounds like this was intended to build something more on this PR. Do you plan to build something else on this (as you asked if you can use this as a base for another PR)? |
Now this is only a cleanup of unused-s. Look at the individual commits. They reduce the set of function signatures like |
The PR title is ambiguous: I've understood it as " |
Better? |
Namespace#SetFieldByName() calls #Set() anyway.
No description provided.