From 276cd0cb80f1ba2e0c0b474e81fb5e0e9aa10dad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Mon, 27 Apr 2020 11:31:51 +0200 Subject: [PATCH 1/4] Create config.yml --- .github/ISSUE_TEMPLATE/config.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..e5cd315d1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,4 @@ +contact_links: + - name: Question + url: https://discord.gg/QXK9XTv + about: Please ask and answer questions here. From 2a5382a97b203c596423ceed149ce90123c7b5b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Mon, 27 Apr 2020 13:24:43 +0200 Subject: [PATCH 2/4] Remove mutex names, fixes #722 Named mutexes are used for inter-process synchronization, using them to synchronize threads of a single process is just begging for trouble when running multiple instances of the application. --- src/include/86box/plat.h | 2 +- src/network/network.c | 2 +- src/video/vid_mga.c | 2 +- src/win/win_thread.c | 4 ++-- src/win/win_ui.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index 32af72c32..a2590350d 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -148,7 +148,7 @@ extern void thread_reset_event(event_t *arg); extern int thread_wait_event(event_t *arg, int timeout); extern void thread_destroy_event(event_t *arg); -extern mutex_t *thread_create_mutex(wchar_t *name); +extern mutex_t *thread_create_mutex(void); extern void thread_close_mutex(mutex_t *arg); extern int thread_wait_mutex(mutex_t *arg); extern int thread_release_mutex(mutex_t *mutex); diff --git a/src/network/network.c b/src/network/network.c index eaf317f89..974a6f607 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -313,7 +313,7 @@ network_reset(void) /* If no active card, we're done. */ if ((network_type==NET_TYPE_NONE) || (network_card==0)) return; - network_mutex = thread_create_mutex(L"VARCem.NetMutex"); + network_mutex = thread_create_mutex(); /* Initialize the platform module. */ switch(network_type) { diff --git a/src/video/vid_mga.c b/src/video/vid_mga.c index ebfc72146..b44043034 100644 --- a/src/video/vid_mga.c +++ b/src/video/vid_mga.c @@ -4997,7 +4997,7 @@ mystique_init(const device_t *info) mystique->wake_fifo_thread = thread_create_event(); mystique->fifo_not_full_event = thread_create_event(); mystique->fifo_thread = thread_create(fifo_thread, mystique); - mystique->dma.lock = thread_create_mutex(L"86Box.MGAMutex"); + mystique->dma.lock = thread_create_mutex(); timer_add(&mystique->wake_timer, mystique_wake_timer, (void *)mystique, 0); timer_add(&mystique->softrap_pending_timer, mystique_softrap_pending_timer, (void *)mystique, 1); diff --git a/src/win/win_thread.c b/src/win/win_thread.c index 494a543c9..000c96706 100644 --- a/src/win/win_thread.c +++ b/src/win/win_thread.c @@ -132,9 +132,9 @@ thread_destroy_event(event_t *arg) mutex_t * -thread_create_mutex(wchar_t *name) +thread_create_mutex(void) { - return((mutex_t*)CreateMutex(NULL, FALSE, name)); + return((mutex_t*)CreateMutex(NULL, FALSE, NULL)); } diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 4c2e46f3a..814484a92 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -962,7 +962,7 @@ ui_init(int nCmdShow) * Before we can create the Render window, we first have * to prepare some other things that it depends on. */ - ghMutex = CreateMutex(NULL, FALSE, L"86Box.BlitMutex"); + ghMutex = CreateMutex(NULL, FALSE, NULL); /* Create the Machine Rendering window. */ hwndRender = CreateWindow(L"STATIC", NULL, WS_CHILD|SS_BITMAP, From 3b357348b02fd18a49bf60213171ddbf1a30fd65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Mon, 27 Apr 2020 14:48:35 +0200 Subject: [PATCH 3/4] win: Add a timeout for the startblit function --- src/win/win.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/win/win.c b/src/win/win.c index e8d2af475..77df9d3d5 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -847,7 +847,10 @@ LPARAM win_get_string(int id) void /* plat_ */ startblit(void) { - WaitForSingleObject(ghMutex, INFINITE); + DWORD ret = WaitForSingleObject(ghMutex, 1000); + + if(ret == WAIT_TIMEOUT) + fatal("The blit mutex has timed out."); } From 93dfb955ddaa75fb05389d95fba5079a3c42bdc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Mon, 27 Apr 2020 15:06:10 +0200 Subject: [PATCH 4/4] Revert "win: Add a timeout for the startblit function" This reverts commit 3b357348b02fd18a49bf60213171ddbf1a30fd65. --- src/win/win.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/win/win.c b/src/win/win.c index 77df9d3d5..e8d2af475 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -847,10 +847,7 @@ LPARAM win_get_string(int id) void /* plat_ */ startblit(void) { - DWORD ret = WaitForSingleObject(ghMutex, 1000); - - if(ret == WAIT_TIMEOUT) - fatal("The blit mutex has timed out."); + WaitForSingleObject(ghMutex, INFINITE); }