@@ -43,12 +43,8 @@ fn main(mut rx: mpsc::UnboundedReceiver<GameThreadMessage>, mut game: Box<dyn Ga
4343 // better (and properly handle states or whatever) we should probably just like... Do so?
4444 let mut suspended = true ;
4545
46- // bring up EGL/CUDA/whatever
47-
4846 let contexts = GraphicsContexts :: create ( 0 ) ;
4947
50- // Spawn the video thread here
51-
5248 let ( video_encoder_control, packet_waiter) = {
5349 #[ cfg( feature = "av-nvidia" ) ]
5450 {
@@ -102,7 +98,8 @@ fn main(mut rx: mpsc::UnboundedReceiver<GameThreadMessage>, mut game: Box<dyn Ga
10298 }
10399
104100 GameThreadMessage :: SetProperty { key, value, tx } => {
105- // TODO: set_property should be failable
101+ // TODO: we should send the error result to the given tx
102+ // so that we can propegate errors to the main thread
106103 match game. set_property ( & key, & value) {
107104 Ok ( _) => { }
108105 Err ( err) => {
@@ -175,14 +172,13 @@ impl GameThread {
175172 }
176173
177174 pub async fn reset ( & self ) {
178- // TODO
179175 let ( tx, rx) = oneshot:: channel ( ) ;
180176 let _ = self . tx . send ( GameThreadMessage :: Reset { tx } ) ;
181177 let _ = rx. await ;
182178 }
183179
184180 pub async fn set_property ( & self , key : String , value : String ) {
185- // TODO
181+ // TODO: This should be failable
186182 let ( tx, rx) = oneshot:: channel ( ) ;
187183 let _ = self . tx . send ( GameThreadMessage :: SetProperty {
188184 key : key. clone ( ) ,
@@ -202,8 +198,8 @@ impl GameThread {
202198 }
203199
204200 /// Shuts down the game thread.
205- pub async fn shutdown ( & self ) {
201+ pub async fn shutdown ( self ) {
206202 let _ = self . tx . send ( GameThreadMessage :: Shutdown ) ;
207- // TODO: join thread (or make it easier for this to be consuming)
203+ self . join_handle . join ( ) . expect ( "Failed to join game thread" ) ;
208204 }
209205}
0 commit comments