fn prepared_parker_new_inner() -> PreparedThreadParker {
PreparedThreadParker {
notifier: ThreadNotifier {
shared: Arc::new(ThreadNotification {
thread: OnceLock::new(),
notified: AtomicBool::new(true),
}),
},
}
}
fn prepared_parker_notice_inner(this: &PreparedThreadParker) -> ThreadNotifier {
this.notifier.clone()
}
fn prepared_parker_bind_inner(this: PreparedThreadParker) -> ThreadParker {
let thread = std::thread::current();
let owner = thread.id();
this.notifier
.shared
.thread
.set(thread)
.expect("预备通知(prepared parker)只能绑定一次原所属线程");
ThreadParker {
notifier: this.notifier,
owner,
local: PhantomData,
}
}