(task_image) Fix TSAN reported data race condition

This commit is contained in:
jdgleaver 2019-07-08 16:58:02 +01:00
parent 7e6cb03f6b
commit 9093c9feb8
1 changed files with 7 additions and 4 deletions

View File

@ -28,7 +28,7 @@
#include "task_file_transfer.h" #include "task_file_transfer.h"
#include "tasks_internal.h" #include "tasks_internal.h"
#include "../dynamic.h" #include "../configuration.h"
enum image_status_enum enum image_status_enum
{ {
@ -192,7 +192,8 @@ static int cb_nbio_image_thumbnail(void *data, size_t len)
nbio_handle_t *nbio = (nbio_handle_t*)data; nbio_handle_t *nbio = (nbio_handle_t*)data;
struct nbio_image_handle *image = nbio ? (struct nbio_image_handle*)nbio->data : NULL; struct nbio_image_handle *image = nbio ? (struct nbio_image_handle*)nbio->data : NULL;
void *handle = image ? image_transfer_new(image->type) : NULL; void *handle = image ? image_transfer_new(image->type) : NULL;
float refresh_rate; settings_t *settings = config_get_ptr();
float refresh_rate = 0.0f;
if (!handle) if (!handle)
return -1; return -1;
@ -209,8 +210,10 @@ static int cb_nbio_image_thumbnail(void *data, size_t len)
image->size = len; image->size = len;
/* Set task iteration duration */ /* Set task iteration duration */
rarch_environment_cb(RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE, &refresh_rate); if (settings)
if (refresh_rate == 0.0f) refresh_rate = settings->floats.video_refresh_rate;
if (refresh_rate <= 0.0f)
refresh_rate = 60.0f; refresh_rate = 60.0f;
image->frame_duration = (unsigned)((1.0 / refresh_rate) * 1000000.0f); image->frame_duration = (unsigned)((1.0 / refresh_rate) * 1000000.0f);