mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 18:20:27 +00:00
autosave_lock/autosave_unlock - no longer require HAVE_THREADS ifdefs
This commit is contained in:
parent
b3d4fe398b
commit
19863e4174
@ -239,13 +239,9 @@ static void netplay_net_post_frame(netplay_t *netplay)
|
||||
if (netplay->replay_frame_count >= netplay->read_frame_count)
|
||||
netplay_simulate_input(netplay, netplay->replay_ptr);
|
||||
|
||||
#if defined(HAVE_THREADS)
|
||||
autosave_lock();
|
||||
#endif
|
||||
core_run();
|
||||
#if defined(HAVE_THREADS)
|
||||
autosave_unlock();
|
||||
#endif
|
||||
netplay->replay_ptr = NEXT_PTR(netplay->replay_ptr);
|
||||
netplay->replay_frame_count++;
|
||||
}
|
||||
|
@ -205,13 +205,9 @@ static void netplay_spectate_post_frame(netplay_t *netplay)
|
||||
|
||||
while (netplay->replay_frame_count < netplay->self_frame_count)
|
||||
{
|
||||
#if defined(HAVE_THREADS)
|
||||
autosave_lock();
|
||||
#endif
|
||||
core_run();
|
||||
#if defined(HAVE_THREADS)
|
||||
autosave_unlock();
|
||||
#endif
|
||||
netplay->replay_ptr = NEXT_PTR(netplay->replay_ptr);
|
||||
netplay->replay_frame_count++;
|
||||
}
|
||||
@ -242,13 +238,9 @@ static void netplay_spectate_post_frame(netplay_t *netplay)
|
||||
|
||||
while (netplay->replay_frame_count < netplay->read_frame_count - 1)
|
||||
{
|
||||
#if defined(HAVE_THREADS)
|
||||
autosave_lock();
|
||||
#endif
|
||||
core_run();
|
||||
#if defined(HAVE_THREADS)
|
||||
autosave_unlock();
|
||||
#endif
|
||||
|
||||
netplay->replay_ptr = NEXT_PTR(netplay->replay_ptr);
|
||||
netplay->replay_frame_count++;
|
||||
@ -268,10 +260,7 @@ static bool netplay_spectate_info_cb(netplay_t* netplay, unsigned frames)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < MAX_SPECTATORS; i++)
|
||||
{
|
||||
netplay->spectate.fds[i] = -1;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1328,9 +1328,7 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(HAVE_THREADS)
|
||||
autosave_lock();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_PRE_FRAME, NULL))
|
||||
@ -1385,9 +1383,7 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_POST_FRAME, NULL);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_THREADS)
|
||||
autosave_unlock();
|
||||
#endif
|
||||
|
||||
if (!settings->fastforward_ratio)
|
||||
return 0;
|
||||
|
@ -258,37 +258,6 @@ static void autosave_free(autosave_t *handle)
|
||||
free(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* autosave_lock:
|
||||
*
|
||||
* Lock autosave.
|
||||
**/
|
||||
void autosave_lock(void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < autosave_state.num; i++)
|
||||
{
|
||||
if (autosave_state.list[i])
|
||||
slock_lock(autosave_state.list[i]->lock);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* autosave_unlock:
|
||||
*
|
||||
* Unlocks autosave.
|
||||
**/
|
||||
void autosave_unlock(void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < autosave_state.num; i++)
|
||||
{
|
||||
if (autosave_state.list[i])
|
||||
slock_unlock(autosave_state.list[i]->lock);
|
||||
}
|
||||
}
|
||||
|
||||
void autosave_init(void)
|
||||
{
|
||||
@ -345,6 +314,42 @@ void autosave_deinit(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* autosave_lock:
|
||||
*
|
||||
* Lock autosave.
|
||||
**/
|
||||
void autosave_lock(void)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < autosave_state.num; i++)
|
||||
{
|
||||
if (autosave_state.list[i])
|
||||
slock_lock(autosave_state.list[i]->lock);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* autosave_unlock:
|
||||
*
|
||||
* Unlocks autosave.
|
||||
**/
|
||||
void autosave_unlock(void)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < autosave_state.num; i++)
|
||||
{
|
||||
if (autosave_state.list[i])
|
||||
slock_unlock(autosave_state.list[i]->lock);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* undo_load_state:
|
||||
* Revert to the state before a state was loaded.
|
||||
|
Loading…
Reference in New Issue
Block a user