@@ -82,15 +82,19 @@ inline bool autoreload_is_enabled() {
82
82
}
83
83
84
84
void autoreload_trigger () {
85
- if (autoreload_enabled & !autoreload_suspended ) {
86
- last_autoreload_trigger = supervisor_ticks_ms32 ();
87
- // Guard against the rare time that ticks is 0;
88
- if (last_autoreload_trigger == 0 ) {
89
- last_autoreload_trigger += 1 ;
90
- }
91
- // Initiate a reload of the VM immediately. Later code will pause to
92
- // wait for the autoreload to become ready. Doing the VM exit
93
- // immediately is clearer for the user.
85
+ if (!autoreload_enabled || autoreload_suspended != 0 ) {
86
+ return ;
87
+ }
88
+ bool reload_initiated = autoreload_pending ();
89
+ last_autoreload_trigger = supervisor_ticks_ms32 ();
90
+ // Guard against the rare time that ticks is 0;
91
+ if (last_autoreload_trigger == 0 ) {
92
+ last_autoreload_trigger += 1 ;
93
+ }
94
+ // Initiate a reload of the VM immediately. Later code will pause to
95
+ // wait for the autoreload to become ready. Doing the VM exit
96
+ // immediately is clearer for the user.
97
+ if (!reload_initiated ) {
94
98
reload_initiate (RUN_REASON_AUTO_RELOAD );
95
99
}
96
100
}
@@ -111,5 +115,5 @@ bool autoreload_ready() {
111
115
}
112
116
113
117
bool autoreload_pending (void ) {
114
- return last_autoreload_trigger != 0 ;
118
+ return last_autoreload_trigger > 0 ;
115
119
}
0 commit comments