@@ -92,7 +92,7 @@ pub const SingleThreaded = struct {
92
92
};
93
93
}
94
94
if (comptime CANCEL_SUPPORTED ) {
95
- self .cancelAll ();
95
+ self .io . cancel_all ();
96
96
}
97
97
self .io .deinit ();
98
98
self .cancel_pool .deinit ();
@@ -142,9 +142,6 @@ pub const SingleThreaded = struct {
142
142
fn eventsNb (self : * Self , comptime event : Event ) usize {
143
143
return @atomicLoad (usize , self .eventsPtr (event ), .seq_cst );
144
144
}
145
- fn resetEvents (self : * Self , comptime event : Event ) void {
146
- @atomicStore (usize , self .eventsPtr (event ), 0 , .unordered );
147
- }
148
145
149
146
// JS callbacks APIs
150
147
// -----------------
@@ -288,36 +285,19 @@ pub const SingleThreaded = struct {
288
285
self .io .cancel_one (* ContextCancel , ctx , cancelCallback , completion , comp_cancel );
289
286
}
290
287
291
- // cancelAll will cancel all future events.
292
- // The loop will not be usable anymore after cancelAll.
293
- // It is used only during the deinit.
294
- fn cancelAll (self : * Self ) void {
295
- self .resetEvents (.js );
296
- self .resetEvents (.zig );
297
- self .io .cancel_all ();
298
- }
299
-
300
288
// Reset all existing JS callbacks.
301
289
// The existing events will happen and their memory will be cleanup but the
302
290
// corresponding callbacks will not be called.
303
291
pub fn resetJS (self : * Self ) void {
304
292
self .js_ctx_id += 1 ;
305
293
self .cancelled .clearRetainingCapacity ();
306
- // We don't call self.resetEvents(.js) intentionnaly.
307
- // Indeed we don't want to prevent the possibility to wait for events.
308
- // The caller may want to wait to have memory correcly cleaned after
309
- // the events happen, even if the callback are ignoreed.
310
294
}
311
295
312
296
// Reset all existing Zig callbacks.
313
297
// The existing events will happen and their memory will be cleanup but the
314
298
// corresponding callbacks will not be called.
315
299
pub fn resetZig (self : * Self ) void {
316
300
self .zig_ctx_id += 1 ;
317
- // We don't call self.resetEvents(.zig) intentionnaly.
318
- // Indeed we don't want to prevent the possibility to wait for events.
319
- // The caller may want to wait to have memory correcly cleaned after
320
- // the events happen, even if the callback are ignoreed.
321
301
}
322
302
323
303
// IO callbacks APIs
0 commit comments