mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-30 14:53:39 +00:00
Move lock to task_overlay.c
This commit is contained in:
parent
04b98bebd9
commit
c90072df55
@ -61,7 +61,7 @@ static void data_runloop_thread_deinit(data_runloop_t *runloop)
|
||||
|
||||
slock_free(runloop->lock);
|
||||
slock_free(runloop->cond_lock);
|
||||
slock_free(runloop->overlay_lock);
|
||||
rarch_main_data_overlay_thread_uninit();
|
||||
scond_free(runloop->cond);
|
||||
}
|
||||
}
|
||||
@ -195,9 +195,12 @@ static void rarch_main_data_thread_init(void)
|
||||
|
||||
runloop->lock = slock_new();
|
||||
runloop->cond_lock = slock_new();
|
||||
runloop->overlay_lock = slock_new();
|
||||
runloop->cond = scond_new();
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
rarch_main_data_overlay_thread_init();
|
||||
#endif
|
||||
|
||||
runloop->thread = sthread_create(data_thread_loop, runloop);
|
||||
|
||||
if (!runloop->thread)
|
||||
@ -212,10 +215,7 @@ static void rarch_main_data_thread_init(void)
|
||||
return;
|
||||
|
||||
error:
|
||||
slock_free(runloop->lock);
|
||||
slock_free(runloop->cond_lock);
|
||||
slock_free(runloop->overlay_lock);
|
||||
scond_free(runloop->cond);
|
||||
data_runloop_thread_deinit(runloop);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -48,7 +48,6 @@ typedef struct data_runloop
|
||||
|
||||
slock_t *lock;
|
||||
slock_t *cond_lock;
|
||||
slock_t *overlay_lock;
|
||||
scond_t *cond;
|
||||
sthread_t *thread;
|
||||
#endif
|
||||
|
@ -14,25 +14,30 @@
|
||||
*/
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
#ifdef HAVE_THREADS
|
||||
#include <rthreads/rthreads.h>
|
||||
#endif
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../runloop.h"
|
||||
#include "../runloop_data.h"
|
||||
#include "tasks.h"
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
static slock_t *overlay_lock;
|
||||
#endif
|
||||
|
||||
void rarch_main_data_overlay_image_upload_iterate(bool is_thread, void *data)
|
||||
{
|
||||
data_runloop_t *runloop = (data_runloop_t*)data;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (rarch_main_is_idle())
|
||||
return;
|
||||
if (!driver->overlay || !runloop)
|
||||
if (!driver->overlay)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
if (is_thread)
|
||||
slock_lock(runloop->overlay_lock);
|
||||
slock_lock(overlay_lock);
|
||||
#endif
|
||||
|
||||
switch (driver->overlay->state)
|
||||
@ -46,13 +51,12 @@ void rarch_main_data_overlay_image_upload_iterate(bool is_thread, void *data)
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
if (is_thread)
|
||||
slock_unlock(runloop->overlay_lock);
|
||||
slock_unlock(overlay_lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
void rarch_main_data_overlay_iterate(bool is_thread, void *data)
|
||||
{
|
||||
data_runloop_t *runloop = (data_runloop_t*)data;
|
||||
driver_t *driver = NULL;
|
||||
|
||||
if (rarch_main_is_idle())
|
||||
@ -60,7 +64,7 @@ void rarch_main_data_overlay_iterate(bool is_thread, void *data)
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
if (is_thread)
|
||||
slock_lock(runloop->overlay_lock);
|
||||
slock_lock(overlay_lock);
|
||||
#endif
|
||||
|
||||
driver = driver_get_ptr();
|
||||
@ -92,6 +96,20 @@ void rarch_main_data_overlay_iterate(bool is_thread, void *data)
|
||||
end: ;
|
||||
#ifdef HAVE_THREADS
|
||||
if (is_thread)
|
||||
slock_unlock(runloop->overlay_lock);
|
||||
slock_unlock(overlay_lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
void rarch_main_data_overlay_thread_uninit(void)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
slock_free(overlay_lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
void rarch_main_data_overlay_thread_init(void)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
overlay_lock = slock_new();
|
||||
#endif
|
||||
}
|
||||
|
@ -100,6 +100,10 @@ void rarch_main_data_overlay_image_upload_iterate(bool is_thread,
|
||||
void *data);
|
||||
|
||||
void rarch_main_data_overlay_iterate(bool is_thread, void *data);
|
||||
|
||||
void rarch_main_data_overlay_thread_uninit(void);
|
||||
|
||||
void rarch_main_data_overlay_thread_init(void);
|
||||
#endif
|
||||
|
||||
void rarch_main_data_nbio_iterate(bool is_thread,
|
||||
|
Loading…
Reference in New Issue
Block a user