Video threads are now woken before the wait for termination, fixes the hangs.

This commit is contained in:
OBattler
2021-07-16 19:22:58 +02:00
parent 78c3f6759f
commit 7047517408
6 changed files with 11 additions and 0 deletions

View File

@@ -3458,6 +3458,7 @@ void mach64_close(void *p)
svga_close(&mach64->svga);
mach64->thread_run = 0;
thread_set_event(mach64->wake_fifo_thread);
thread_wait(mach64->fifo_thread, -1);
thread_destroy_event(mach64->wake_fifo_thread);
thread_destroy_event(mach64->fifo_not_full_event);

View File

@@ -5035,6 +5035,7 @@ mystique_close(void *p)
mystique_t *mystique = (mystique_t *)p;
mystique->thread_run = 0;
thread_set_event(mystique->wake_fifo_thread);
thread_wait(mystique->fifo_thread, -1);
thread_destroy_event(mystique->wake_fifo_thread);
thread_destroy_event(mystique->fifo_not_full_event);

View File

@@ -6321,6 +6321,7 @@ static void s3_close(void *p)
svga_close(&s3->svga);
s3->thread_run = 0;
thread_set_event(s3->wake_fifo_thread);
thread_wait(s3->fifo_thread, -1);
thread_destroy_event(s3->wake_fifo_thread);
thread_destroy_event(s3->fifo_not_full_event);

View File

@@ -3920,12 +3920,14 @@ static void s3_virge_close(void *p)
virge_t *virge = (virge_t *)p;
virge->render_thread_run = 0;
thread_set_event(virge->wake_render_thread);
thread_wait(virge->render_thread, -1);
thread_destroy_event(virge->not_full_event);
thread_destroy_event(virge->wake_main_thread);
thread_destroy_event(virge->wake_render_thread);
virge->fifo_thread_run = 0;
thread_set_event(virge->wake_fifo_thread);
thread_wait(virge->fifo_thread, -1);
thread_destroy_event(virge->wake_fifo_thread);
thread_destroy_event(virge->fifo_not_full_event);

View File

@@ -1256,17 +1256,22 @@ void voodoo_card_close(voodoo_t *voodoo)
voodoo->fifo_thread_run = 0;
thread_set_event(voodoo->wake_fifo_thread);
thread_wait(voodoo->fifo_thread, -1);
voodoo->render_thread_run[0] = 0;
thread_set_event(voodoo->wake_render_thread[0]);
thread_wait(voodoo->render_thread[0], -1);
if (voodoo->render_threads >= 2) {
voodoo->render_thread_run[1] = 0;
thread_set_event(voodoo->wake_render_thread[1]);
thread_wait(voodoo->render_thread[1], -1);
}
if (voodoo->render_threads == 4) {
voodoo->render_thread_run[2] = 0;
thread_set_event(voodoo->wake_render_thread[2]);
thread_wait(voodoo->render_thread[2], -1);
voodoo->render_thread_run[3] = 0;
thread_set_event(voodoo->wake_render_thread[3]);
thread_wait(voodoo->render_thread[3], -1);
}
thread_destroy_event(voodoo->fifo_not_full_event);

View File

@@ -890,6 +890,7 @@ void
video_close(void)
{
thread_run = 0;
thread_set_event(blit_data.wake_blit_thread);
thread_wait(blit_data.blit_thread, -1);
thread_destroy_event(blit_data.buffer_not_in_use);
thread_destroy_event(blit_data.blit_complete);