6
6
//! [`join()`]: ../join/join.fn.html
7
7
8
8
use std:: any:: Any ;
9
+ use std:: collections:: HashSet ;
9
10
use std:: marker:: PhantomData ;
10
11
use std:: mem:: ManuallyDrop ;
11
12
use std:: sync:: atomic:: { AtomicPtr , Ordering } ;
12
13
use std:: sync:: { Arc , Mutex } ;
13
14
use std:: { fmt, ptr} ;
14
15
15
- use indexmap:: IndexSet ;
16
-
17
16
use crate :: broadcast:: BroadcastContext ;
18
17
use crate :: job:: { ArcJob , HeapJob , JobFifo , JobRef , JobRefId } ;
19
18
use crate :: latch:: { CountLatch , Latch } ;
@@ -55,7 +54,8 @@ struct ScopeBase<'scope> {
55
54
job_completed_latch : CountLatch ,
56
55
57
56
/// Jobs that have been spawned, but not yet started.
58
- pending_jobs : Mutex < IndexSet < JobRefId > > ,
57
+ #[ allow( rustc:: default_hash_types) ]
58
+ pending_jobs : Mutex < HashSet < JobRefId > > ,
59
59
60
60
/// The worker which will wait on scope completion, if any.
61
61
worker : Option < usize > ,
@@ -538,7 +538,7 @@ impl<'scope> Scope<'scope> {
538
538
let scope = scope_ptr. as_ref ( ) ;
539
539
540
540
// Mark this job is started.
541
- scope. base . pending_jobs . lock ( ) . unwrap ( ) . swap_remove_full ( & id) ;
541
+ scope. base . pending_jobs . lock ( ) . unwrap ( ) . remove ( & id) ;
542
542
543
543
ScopeBase :: execute_job ( & scope. base , move || body ( scope) )
544
544
} ) ;
@@ -569,7 +569,7 @@ impl<'scope> Scope<'scope> {
569
569
let current_index = WorkerThread :: current ( ) . as_ref ( ) . map ( |worker| worker. index ( ) ) ;
570
570
if current_index == scope. base . worker {
571
571
// Mark this job as started on the scope's worker thread.
572
- scope. base . pending_jobs . lock ( ) . unwrap ( ) . swap_remove ( & id) ;
572
+ scope. base . pending_jobs . lock ( ) . unwrap ( ) . remove ( & id) ;
573
573
}
574
574
575
575
let func = move || BroadcastContext :: with ( move |ctx| body ( scope, ctx) ) ;
@@ -611,7 +611,7 @@ impl<'scope> ScopeFifo<'scope> {
611
611
let scope = scope_ptr. as_ref ( ) ;
612
612
613
613
// Mark this job is started.
614
- scope. base . pending_jobs . lock ( ) . unwrap ( ) . swap_remove ( & id) ;
614
+ scope. base . pending_jobs . lock ( ) . unwrap ( ) . remove ( & id) ;
615
615
616
616
ScopeBase :: execute_job ( & scope. base , move || body ( scope) )
617
617
} ) ;
@@ -642,7 +642,7 @@ impl<'scope> ScopeFifo<'scope> {
642
642
let current_index = WorkerThread :: current ( ) . as_ref ( ) . map ( |worker| worker. index ( ) ) ;
643
643
if current_index == scope. base . worker {
644
644
// Mark this job as started on the scope's worker thread.
645
- scope. base . pending_jobs . lock ( ) . unwrap ( ) . swap_remove ( & id) ;
645
+ scope. base . pending_jobs . lock ( ) . unwrap ( ) . remove ( & id) ;
646
646
}
647
647
let body = & body;
648
648
let func = move || BroadcastContext :: with ( move |ctx| body ( scope, ctx) ) ;
@@ -664,7 +664,8 @@ impl<'scope> ScopeBase<'scope> {
664
664
registry : Arc :: clone ( registry) ,
665
665
panic : AtomicPtr :: new ( ptr:: null_mut ( ) ) ,
666
666
job_completed_latch : CountLatch :: new ( owner) ,
667
- pending_jobs : Mutex :: new ( IndexSet :: new ( ) ) ,
667
+ #[ allow( rustc:: default_hash_types) ]
668
+ pending_jobs : Mutex :: new ( HashSet :: new ( ) ) ,
668
669
worker : owner. map ( |w| w. index ( ) ) ,
669
670
marker : PhantomData ,
670
671
tlv : tlv:: get ( ) ,
0 commit comments