Skip to content

Commit b686a57

Browse files
committed
Resync
1 parent 2aefcd8 commit b686a57

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

include/queues/task_queue.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ char* task_get_title(retro_task_t *task);
191191

192192
void* task_get_data(retro_task_t *task);
193193

194+
bool task_is_on_main_thread(void);
195+
194196
void task_queue_set_threaded(void);
195197

196198
void task_queue_unset_threaded(void);

queues/task_queue.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ static struct retro_task_impl *impl_current = NULL;
6666
static bool task_threaded_enable = false;
6767

6868
#ifdef HAVE_THREADS
69+
static uintptr_t main_thread_id = 0;
6970
static slock_t *running_lock = NULL;
7071
static slock_t *finished_lock = NULL;
7172
static slock_t *property_lock = NULL;
@@ -614,6 +615,7 @@ void task_queue_init(bool threaded, retro_task_queue_msg_t msg_push)
614615
impl_current = &impl_regular;
615616

616617
#ifdef HAVE_THREADS
618+
main_thread_id = sthread_get_current_thread_id();
617619
if (threaded)
618620
{
619621
task_threaded_enable = true;
@@ -750,6 +752,15 @@ void task_queue_retriever_info_free(task_retriever_info_t *list)
750752
}
751753
}
752754

755+
bool task_is_on_main_thread(void)
756+
{
757+
#ifdef HAVE_THREADS
758+
return sthread_get_current_thread_id() == main_thread_id;
759+
#else
760+
return true;
761+
#endif
762+
}
763+
753764
void task_set_finished(retro_task_t *task, bool finished)
754765
{
755766
SLOCK_LOCK(property_lock);

streams/file_stream.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,11 @@ int filestream_vscanf(RFILE *stream, const char* format, va_list *args)
241241
* cause the va_list to have an indeterminate value
242242
* in the function calling filestream_vscanf(),
243243
* leading to unexpected behaviour */
244+
#ifdef __va_copy
245+
__va_copy(args_copy, *args);
246+
#else
244247
va_copy(args_copy, *args);
248+
#endif
245249

246250
while (*format)
247251
{

0 commit comments

Comments
 (0)