mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Merge pull request #7209 from RetroSven/master
provide a means for cores to coordinate with the frontend when shutting down multiple threads gracefully
This commit is contained in:
commit
9bf2fb8f79
21
dynamic.c
21
dynamic.c
@ -1042,6 +1042,16 @@ static void core_performance_counter_stop(struct retro_perf_counter *perf)
|
||||
perf->total += cpu_features_get_perf_counter() - perf->start;
|
||||
}
|
||||
|
||||
bool rarch_clear_all_thread_waits(unsigned clear_threads, void *data)
|
||||
{
|
||||
if ( clear_threads > 0)
|
||||
audio_driver_start(false) ;
|
||||
else
|
||||
audio_driver_stop() ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
/**
|
||||
* rarch_environment_cb:
|
||||
* @cmd : Identifier of command.
|
||||
@ -1833,8 +1843,8 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
int* result_p = (int*)data;
|
||||
*result_p = result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_MIDI_INTERFACE:
|
||||
{
|
||||
@ -1849,16 +1859,21 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
midi_interface->write = midi_driver_write;
|
||||
midi_interface->flush = midi_driver_flush;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_FASTFORWARDING:
|
||||
{
|
||||
extern bool runloop_fastmotion;
|
||||
*(bool *)data = runloop_fastmotion;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_CLEAR_ALL_THREAD_WAITS_CB:
|
||||
{
|
||||
*(retro_environment_t *)data = rarch_clear_all_thread_waits;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
RARCH_LOG("Environ UNSUPPORTED (#%u).\n", cmd);
|
||||
|
@ -1191,10 +1191,12 @@ struct retro_led_interface
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_FASTFORWARDING (49 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* bool * --
|
||||
* Boolean value that indicates whether or not the frontend is in
|
||||
* Boolean value that indicates whether or not the frontend is in
|
||||
* fastforwarding mode.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* Retrieves the current state of the MIDI input.
|
||||
* Returns true if it's enabled, false otherwise. */
|
||||
typedef bool (RETRO_CALLCONV *retro_midi_input_enabled_t)(void);
|
||||
|
16
retroarch.h
16
retroarch.h
@ -33,7 +33,21 @@
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_SAVE_STATE_IN_BACKGROUND RETRO_ENVIRONMENT_PRIVATE+1
|
||||
#define RETRO_ENVIRONMENT_RETROARCH_START_BLOCK 0x800000
|
||||
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_SAVE_STATE_IN_BACKGROUND (2 | RETRO_ENVIRONMENT_RETROARCH_START_BLOCK)
|
||||
/* bool * --
|
||||
* Boolean value that tells the front end to save states in the
|
||||
* background or not.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_CLEAR_ALL_THREAD_WAITS_CB (3 | RETRO_ENVIRONMENT_RETROARCH_START_BLOCK)
|
||||
/* retro_environment_t * --
|
||||
* Provides the callback to the frontend method which will cancel
|
||||
* all currently waiting threads. Used when coordination is needed
|
||||
* between the core and the frontend to gracefully stop all threads.
|
||||
*/
|
||||
|
||||
enum rarch_ctl_state
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user