mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-02-01 14:01:20 +00:00
Merge pull request #316 from carlo-bramini/fluid_msleep
Introduce fluid_msleep function.
This commit is contained in:
commit
acb8da48f4
4 changed files with 15 additions and 7 deletions
|
@ -391,7 +391,7 @@ fluid_jack_client_close (fluid_jack_client_t *client_ref, void *driver)
|
||||||
|
|
||||||
if (client_ref->audio_driver || client_ref->midi_driver)
|
if (client_ref->audio_driver || client_ref->midi_driver)
|
||||||
{
|
{
|
||||||
g_usleep (100000); /* FIXME - Hack to make sure that resources don't get freed while Jack callback is active */
|
fluid_msleep(100); /* FIXME - Hack to make sure that resources don't get freed while Jack callback is active */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1823,11 +1823,7 @@ fluid_player_join(fluid_player_t *player)
|
||||||
} else if (player->sample_timer) {
|
} else if (player->sample_timer) {
|
||||||
/* Busy-wait loop, since there's no thread to wait for... */
|
/* Busy-wait loop, since there's no thread to wait for... */
|
||||||
while (player->status != FLUID_PLAYER_DONE) {
|
while (player->status != FLUID_PLAYER_DONE) {
|
||||||
#if defined(WIN32)
|
fluid_msleep(10);
|
||||||
Sleep(10);
|
|
||||||
#else
|
|
||||||
usleep(10000);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FLUID_OK;
|
return FLUID_OK;
|
||||||
|
|
|
@ -344,6 +344,15 @@ fluid_is_soundfont(const char *filename)
|
||||||
return strncmp(id, "RIFF", 4) == 0;
|
return strncmp(id, "RIFF", 4) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Suspend the execution of the current thread for the specified amount of time.
|
||||||
|
* @param milliseconds to wait.
|
||||||
|
*/
|
||||||
|
void fluid_msleep(unsigned int msecs)
|
||||||
|
{
|
||||||
|
g_usleep(msecs * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get time in milliseconds to be used in relative timing operations.
|
* Get time in milliseconds to be used in relative timing operations.
|
||||||
* @return Unix time in milliseconds.
|
* @return Unix time in milliseconds.
|
||||||
|
@ -692,7 +701,7 @@ fluid_timer_run (void *data)
|
||||||
two callbacks bringing in the "absolute" time (count *
|
two callbacks bringing in the "absolute" time (count *
|
||||||
timer->msec) */
|
timer->msec) */
|
||||||
delay = (count * timer->msec) - (fluid_curtime() - start);
|
delay = (count * timer->msec) - (fluid_curtime() - start);
|
||||||
if (delay > 0) g_usleep (delay * 1000);
|
if (delay > 0) fluid_msleep(delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUID_LOG (FLUID_DBG, "Timer thread finished");
|
FLUID_LOG (FLUID_DBG, "Timer thread finished");
|
||||||
|
|
|
@ -460,4 +460,7 @@ extern fluid_profile_data_t fluid_profile_data[];
|
||||||
unsigned int fluid_check_fpe_i386(char * explanation_in_case_of_fpe);
|
unsigned int fluid_check_fpe_i386(char * explanation_in_case_of_fpe);
|
||||||
void fluid_clear_fpe_i386(void);
|
void fluid_clear_fpe_i386(void);
|
||||||
|
|
||||||
|
/* System control */
|
||||||
|
void fluid_msleep(unsigned int msecs);
|
||||||
|
|
||||||
#endif /* _FLUID_SYS_H */
|
#endif /* _FLUID_SYS_H */
|
||||||
|
|
Loading…
Reference in a new issue