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