MCPcopy Create free account
hub / github.com/Logicalshift/flo_draw / create_glutin_thread

Function create_glutin_thread

draw/src/glutin_thread.rs:105–124  ·  view source on GitHub ↗

Starts the glutin thread running

()

Source from the content-addressed store, hash-verified

103/// Starts the glutin thread running
104///
105fn 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

Callers 1

glutin_threadFunction · 0.85

Calls 2

run_glutin_threadFunction · 0.85
intoMethod · 0.45

Tested by

no test coverage detected