use std::{
sync::OnceLock,
thread::{ThreadId, current},
};
static WINDOW_THREAD: OnceLock<ThreadId> = OnceLock::new();
pub(crate) fn set_window_thread() {
let current_id = current().id();
#[expect(clippy::unwrap_used)]
match WINDOW_THREAD.get() {
None => WINDOW_THREAD.set(current_id).unwrap(),
Some(id) => {
assert!(
*id == current_id,
"Graphics/windowing functionality is only supported on the same thread."
);
}
}
}