mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
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:
parent
8ea275a376
commit
851b3e32bd
1 changed files with 3 additions and 1 deletions
|
@ -53,7 +53,9 @@ thread_local!(static STATE: RefCell<Option<ThreadState>> = RefCell::new(None));
|
||||||
pub fn initialize(x: ThreadState) {
|
pub fn initialize(x: ThreadState) {
|
||||||
STATE.with(|ref k| {
|
STATE.with(|ref k| {
|
||||||
if let Some(ref s) = *k.borrow() {
|
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);
|
*k.borrow_mut() = Some(x);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue