Fix window resize not always working
Change doresize to atomic_flag to prevent race condition
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
#include <stdatomic.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
@@ -97,7 +99,7 @@
|
||||
/* Stuff that used to be globally declared in plat.h but is now extern there
|
||||
and declared here instead. */
|
||||
int dopause; /* system is paused */
|
||||
int doresize; /* screen resize requested */
|
||||
atomic_flag doresize; /* screen resize requested */
|
||||
volatile int is_quit; /* system exit requested */
|
||||
uint64_t timer_freq;
|
||||
char emu_version[200]; /* version ID string */
|
||||
@@ -1286,9 +1288,7 @@ set_screen_size(int x, int y)
|
||||
|
||||
/* If the resolution has changed, let the main thread handle it. */
|
||||
if ((owsx != scrnsz_x) || (owsy != scrnsz_y))
|
||||
doresize = 1;
|
||||
else
|
||||
doresize = 0;
|
||||
atomic_flag_clear(&doresize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user