Commit e7131b5d authored by Max Kellermann's avatar Max Kellermann

utils: use g_usleep() instead of my_usleep()

Now that I've found this nice function in the GLib docs, we can finally remove our custom sleep function. Still all those callers of g_usleep() have to be migrated one day to use events, instead of regular polling.
parent c2286354
......@@ -24,7 +24,6 @@
#include "audio.h"
#include "song.h"
#include "utils.h"
#include "normalize.h"
#include "pipe.h"
......@@ -129,7 +128,7 @@ size_t decoder_read(struct decoder *decoder,
/* sleep for a fraction of a second! */
/* XXX don't sleep, wait for an event instead */
my_usleep(10000);
g_usleep(10000);
}
}
......
......@@ -16,7 +16,6 @@
*/
#include "../output_api.h"
#include "../utils.h"
#include "config.h"
#include <assert.h>
......@@ -421,7 +420,7 @@ mpd_jack_play(void *data, const char *buff, size_t size)
} else {
/* XXX do something more intelligent to
synchronize */
my_usleep(1000);
g_usleep(1000);
}
}
......
......@@ -17,7 +17,6 @@
*/
#include "../output_api.h"
#include "../utils.h"
#include <glib.h>
#include <AudioUnit/AudioUnit.h>
......@@ -171,7 +170,7 @@ osx_render(void *vdata,
buffer->mDataByteSize = bufferSize;
if (!bufferSize) {
my_usleep(1000);
g_usleep(1000);
}
return 0;
......
......@@ -17,7 +17,6 @@
*/
#include "timer.h"
#include "utils.h"
#include "audio_format.h"
#include <glib.h>
......@@ -78,5 +77,5 @@ void timer_sync(Timer *timer)
sleep_duration = timer->time - now();
if (sleep_duration > 0)
my_usleep(sleep_duration);
g_usleep(sleep_duration);
}
......@@ -40,20 +40,6 @@
#include <windows.h>
#endif
void my_usleep(long usec)
{
#ifdef WIN32
Sleep(usec / 1000);
#else
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = usec;
select(0, NULL, NULL, NULL, &tv);
#endif
}
char *parsePath(char *path)
{
#ifndef WIN32
......
......@@ -28,8 +28,6 @@
} while (0)
#endif /* !assert_static */
void my_usleep(long usec);
char *parsePath(char *path);
int set_nonblocking(int fd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment