mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Cleanup ActorRegistry::create_shareable.
This commit is contained in:
parent
0234bbe444
commit
f62fbbaed8
1 changed files with 9 additions and 7 deletions
|
@ -110,16 +110,18 @@ impl ActorRegistry {
|
|||
}
|
||||
|
||||
/// Creating shareable registry
|
||||
pub fn create_shareable(self) -> Arc<Mutex<ActorRegistry>>{
|
||||
if self.shareable.is_some() {
|
||||
return self.shareable.unwrap();
|
||||
pub fn create_shareable(self) -> Arc<Mutex<ActorRegistry>> {
|
||||
if let Some(shareable) = self.shareable {
|
||||
return shareable;
|
||||
}
|
||||
|
||||
let shareable = Arc::new(Mutex::new(self));
|
||||
let mut lock = shareable.lock();
|
||||
let registry = lock.as_mut().unwrap();
|
||||
registry.shareable = Some(shareable.clone());
|
||||
shareable.clone()
|
||||
{
|
||||
let mut lock = shareable.lock();
|
||||
let registry = lock.as_mut().unwrap();
|
||||
registry.shareable = Some(shareable.clone());
|
||||
}
|
||||
shareable
|
||||
}
|
||||
|
||||
/// Get shareable registry through threads
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue