Non compiling attempt to reuse cell::Ref for safety locking
(could be simplified) This illustrates that it's a bit tricky: it's tempting to leverage the RefCell we have to forbid mutation of the HashSet while an iterator on it is active. The idea would be that if the iterator has one of those Refs, simply by droping it, it would decrement the immutable borrow counter from the main RustSet RefCell But this doesn't work, because cell::Ref is not Send, hence can't be used as data within `py_class!`. Here, it would have been safe, though, because no Rust code will interfere with these while they are leaked to the Python side and the Python side is protected by the GIL. We'll have to implement an higher level locking system
Please register or sign in to comment