ELBXLSZ3LKHEXX7T7FU2EE6UTZI2QXUTV4ZM66PGSKVLHSHXQVWAC DZPGVVKGX6QS4HX5GVF3DR3UZAV2EOMMVRUDEGTR2OPJVDG3FNXQC KZHJWO3QVI2Q4TVUDYZVFDSXIDVGMUWTDE42BPD2A7MW6OIQGONAC L6RIUKGLJZLAOKFGUDTZKBPP4HUBPEZAKHJEQHO34WFF62AB2ZIQC OGNLZ5CUNFD7X43S4VTMCCEMJA2R76O35XACIR7AUBHPGME27E3AC O5P6HCPWGMGJBFJEMC3SYQJ5OEW2AQV4KEJCMRVTTS3K6M45Z3BAC GKGOXYENXXG6XJXPLXVSWKOYWHZRKNT5JDTAAQ2XWWYGJTLFH5IAC RSKZITUCAFUWNT5UT7752VOM7BK6E2O7YHSUCKBXMYMT6PUNCP6QC MMCK5BQQST5NDI5R3VLY7ICBGNARTYG2FKKRPRIXQHXXGH2QO3PQC PAOLWMH7TLJLNAWBJBWP7KB7YGDFUPASMTFU33KZ3QW5JXJMPXCAC }}/// Retrieves the game lockfn get_lock<'a, S>(&'a mut self, game: &'a AsyncMutex<Game<S>>) -> AsyncMutexGuard<Game<S>>whereS: 'static,{let winit_proxy = Mutex::new(self.event_loop_proxy.clone());let (tx, rx) = flume::bounded(1);let waker = waker_fn::waker_fn(move || {let id_to_poll = rx.recv().unwrap();let _ = winit_proxy.lock().unwrap().send_event(PollTask::Task(id_to_poll));});// self.lock_tasks.push_back(Box::pin(game.lock_arc()));loop {// Continuously try to get the lock until we succeedlet fut = game.lock();let fut = pin!(fut);let poll_status = fut.poll(&mut Context::from_waker(&waker));if let Poll::Ready(res) = poll_status {break res;}// Drive the task loopif let Some(id) = self.tasks.keys().next().copied() {tx.send(id).unwrap();}
fn get_lock_owned<S>(&mut self, game: Arc<AsyncMutex<Game<S>>>) -> AsyncMutexGuardOwned<Game<S>>whereS: 'static,{let winit_proxy = Mutex::new(self.event_loop_proxy.clone());let (tx, rx) = flume::unbounded();let waker = waker_fn::waker_fn(move || {let id_to_poll = rx.recv().unwrap();let _ = winit_proxy.lock().unwrap().send_event(PollTask::Task(id_to_poll));});// self.lock_tasks.push_back(Box::pin(game.lock_arc()));let mut fut = Box::pin(game.lock_arc());loop {let fut = pin!(fut.as_mut());let poll_status = fut.poll(&mut Context::from_waker(&waker));if let Poll::Ready(res) = poll_status {break res;}// Drive the task loopif let Some(id) = self.tasks.keys().next().copied() {tx.send(id).unwrap();}}}
Event::UserEvent(PollTask(tid)) => {if let Some(res) = winit_executor.poll(tid) {// the stuff here shouldn't failres.unwrap()
Event::UserEvent(poll_task) => {match poll_task {// a certain task needs pollingPollTask::Task(tid) => {if let Some(res) = winit_executor.poll(tid) {// the stuff here shouldn't failres.unwrap()}}