Creates or retrieves the glutin thread
()
| 35 | /// Creates or retrieves the glutin thread |
| 36 | /// |
| 37 | pub fn glutin_thread() -> Arc<GlutinThread> { |
| 38 | GLUTIN_THREAD.sync(|thread| { |
| 39 | if let Some(thread) = thread { |
| 40 | // Thread is already running |
| 41 | Arc::clone(thread) |
| 42 | } else { |
| 43 | // Need to start a new thread |
| 44 | let new_thread = create_glutin_thread(); |
| 45 | *thread = Some(Arc::clone(&new_thread)); |
| 46 | |
| 47 | new_thread |
| 48 | } |
| 49 | }) |
| 50 | } |
| 51 | |
| 52 | struct StopGlutinWhenDropped; |
| 53 | impl Drop for StopGlutinWhenDropped { |
no test coverage detected