Commit graph

11 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
ad602a0fa8
style: Export a size to fix a test that was trying to use a now-private type. 2020-04-23 05:07:02 +02:00
Anthony Ramine
7f54d14904 Make the rule tree actually threadsafe
RuleTree::gc is now a safe method that any thread can call
at any time, and StrongRuleNode values can all be dropped
whenever their owner want to, on any thread.
2020-04-20 17:39:19 +02:00
Anthony Ramine
1c2de5641c Change Map::get_or_insert_with to Map::entry 2020-04-20 14:17:14 +02:00
Anthony Ramine
c113fbb640 Always upgrade existing weak child references in the rule tree
Just because we didn't find a child when read-locking a node children list
doesn't mean it still won't exist while we wait to upgrade the read lock
into a write lock to create the child.
2020-04-18 12:11:34 +02:00
Anthony Ramine
a30da7ad8e Introduce a new type UnsafeBox<T> in the rule tree
This lets us rely less on raw pointers, thus better tracking the lifetime
of the rule node values while dropping strong references etc.
2020-04-17 12:41:10 +02:00
Anthony Ramine
bc4e2942bf Make StrongRuleNode::downgrade be unsafe 2020-04-17 12:41:09 +02:00
Anthony Ramine
fb28ce6bbe Make StrongRuleNode::ensure_child take a StrongRuleNode for the root 2020-04-17 12:41:09 +02:00
Anthony Ramine
37c70609f9 Remove WeakRuleNode::clone
MallocSizeOf for RuleTree should not keep around weak references in
case someone runs a GC meanwhile.
2020-04-17 12:41:09 +02:00
Anthony Ramine
e06e164571 Make WeakRuleNode::from_ptr be unsafe 2020-04-17 12:41:09 +02:00
Anthony Ramine
05accaa7bd Make StrongRuleNode::from_ptr be unsafe 2020-04-17 12:41:08 +02:00
Anthony Ramine
e5cb3d2a4c Move the meat of the rule tree to a submodule "core" 2020-04-17 12:41:08 +02:00