@@ -711,6 +711,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
711
711
} ;
712
712
713
713
async {
714
+ let _permit = this. semaphore . acquire ( ) . await . unwrap ( ) ;
714
715
let ( result, duration, memory_usage) = CaptureFuture :: new ( future) . await ;
715
716
716
717
// wait for all spawned local tasks using `local` to finish
@@ -763,7 +764,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
763
764
. unwrap ( ) ;
764
765
}
765
766
#[ cfg( not( feature = "tokio_tracing" ) ) ]
766
- tokio:: task :: spawn ( future) ;
767
+ tokio:: spawn ( future) ;
767
768
}
768
769
769
770
fn schedule_local_task (
@@ -811,6 +812,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
811
812
crate :: task:: local_task:: get_local_task_execution_spec ( & * this, & ty, persistence) ;
812
813
let ty = ty. clone ( ) ;
813
814
async move {
815
+ let _permit = this. semaphore . acquire ( ) . await . unwrap ( ) ;
814
816
let ( result, _duration, _memory_usage) = CaptureFuture :: new ( future) . await ;
815
817
816
818
let result = match result {
@@ -854,7 +856,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
854
856
. spawn ( future)
855
857
. unwrap ( ) ;
856
858
#[ cfg( not( feature = "tokio_tracing" ) ) ]
857
- tokio:: task :: spawn ( future) ;
859
+ tokio:: spawn ( future) ;
858
860
859
861
RawVc :: LocalOutput ( execution_id, local_task_id, persistence)
860
862
}
@@ -1117,6 +1119,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
1117
1119
}
1118
1120
let this2 = this. clone ( ) ;
1119
1121
if !this. stopped . load ( Ordering :: Acquire ) {
1122
+ let _permit = this2. semaphore . acquire ( ) . await . unwrap ( ) ;
1120
1123
func ( this) . await ;
1121
1124
}
1122
1125
if this2
@@ -1145,6 +1148,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
1145
1148
TURBO_TASKS
1146
1149
. scope ( this. clone ( ) , async move {
1147
1150
if !this. stopped . load ( Ordering :: Acquire ) {
1151
+ let _permit = this. semaphore . acquire ( ) . await . unwrap ( ) ;
1148
1152
func ( this. clone ( ) ) . await ;
1149
1153
}
1150
1154
this. finish_foreground_job ( ) ;
0 commit comments