Starts the glutin thread running
()
| 103 | /// Starts the glutin thread running |
| 104 | /// |
| 105 | fn create_glutin_thread() -> Arc<GlutinThread> { |
| 106 | // The event loop thread will send us a proxy once it's initialized |
| 107 | let (send_proxy, recv_proxy) = mpsc::channel(); |
| 108 | |
| 109 | // Run the event loop on its own thread |
| 110 | thread::Builder::new() |
| 111 | .name("Glutin event thread".into()) |
| 112 | .spawn(move || { |
| 113 | run_glutin_thread(send_proxy) |
| 114 | }) |
| 115 | .expect("Glutin thread is running"); |
| 116 | |
| 117 | // Wait for the proxy to be created |
| 118 | let proxy = recv_proxy.recv().expect("Glutin thread will send us a proxy after initialising"); |
| 119 | |
| 120 | // Create a GlutinThread object to communicate with this thread |
| 121 | Arc::new(GlutinThread { |
| 122 | event_proxy: Desync::new(proxy) |
| 123 | }) |
| 124 | } |
| 125 | |
| 126 | /// |
| 127 | /// Runs a glutin thread, posting the proxy to the specified channel |
no test coverage detected