File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
omp-gdk/src/scripting/core Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 11#![ allow( clippy:: all) ]
2+ use std:: collections:: VecDeque ;
3+
24use crate :: { events:: EventArgs , runtime:: each_module, types:: stringview:: StringView } ;
35
46#[ repr( C ) ]
@@ -8,11 +10,12 @@ pub struct OnTickArgs {
810
911#[ no_mangle]
1012pub unsafe extern "C" fn OMPRS_OnTick ( args : * const EventArgs < OnTickArgs > ) {
11- crate :: runtime:: API_QUEUE . with_borrow_mut ( |queue| {
12- while let Some ( api_call) = queue. pop_front ( ) {
13- api_call ( ) ;
14- }
15- } ) ;
13+ let api_calls: VecDeque < _ > =
14+ crate :: runtime:: API_QUEUE . with_borrow_mut ( |queue| queue. drain ( ..) . collect ( ) ) ;
15+ // drop mutable reference to api queue before calling api callbacks
16+ for callback in api_calls {
17+ callback ( ) ;
18+ }
1619
1720 each_module ( move |mut script| {
1821 script. on_tick ( * ( * ( * args) . list ) . elapsed ) ;
You can’t perform that action at this time.
0 commit comments