We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f84614c commit 281b809Copy full SHA for 281b809
src/lib.rs
@@ -465,12 +465,21 @@ impl Once {
465
466
#[inline(always)]
467
pub fn call_once<F>(&'static self, work: F) where F: FnOnce() {
468
- let predicate = unsafe { *self.predicate.get() };
469
- if predicate != !0 {
+ #[cold]
+ #[inline(never)]
470
+ fn once<F>(predicate: *mut dispatch_once_t, work: F)
471
+ where F: FnOnce() {
472
let mut work = Some(work);
473
let (context, work) = context_and_sync_function(&mut work);
474
unsafe {
- dispatch_once_f(self.predicate.get(), context, work);
475
+ dispatch_once_f(predicate, context, work);
476
+ }
477
478
+
479
+ unsafe {
480
+ let predicate = self.predicate.get();
481
+ if *predicate != !0 {
482
+ once(predicate, work);
483
}
484
485
0 commit comments