style: allow re-initializing thread_state as long as it's with the same value.

This unbusts running multiple rule-tree benchmarks at the same time.
This commit is contained in:
Emilio Cobos Álvarez 2017-10-08 12:54:29 +02:00
parent 8ea275a376
commit 851b3e32bd
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -53,7 +53,9 @@ thread_local!(static STATE: RefCell<Option<ThreadState>> = RefCell::new(None));
pub fn initialize(x: ThreadState) {
STATE.with(|ref k| {
if let Some(ref s) = *k.borrow() {
panic!("Thread state already initialized as {:?}", s);
if x != *s {
panic!("Thread state already initialized as {:?}", s);
}
}
*k.borrow_mut() = Some(x);
});