aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-19 13:33:03 +0100
committerMax Kellermann <max@duempel.org>2009-02-19 13:33:03 +0100
commite7131b5da256c3d9472e3e3fdb826ae14da13188 (patch)
tree626025b6c71b139b1ab1054e8d0ea495fe53ff69
parentc228635489fad76321e1718a53220e7b0b095e98 (diff)
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.
-rw-r--r--src/decoder_api.c3
-rw-r--r--src/output/jack_plugin.c3
-rw-r--r--src/output/osx_plugin.c3
-rw-r--r--src/timer.c3
-rw-r--r--src/utils.c14
-rw-r--r--src/utils.h2
6 files changed, 4 insertions, 24 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c
index dfb111a9..d1e3e0a0 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -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);
}
}
diff --git a/src/output/jack_plugin.c b/src/output/jack_plugin.c
index 49f8fd83..2bcdf874 100644
--- a/src/output/jack_plugin.c
+++ b/src/output/jack_plugin.c
@@ -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);
}
}
diff --git a/src/output/osx_plugin.c b/src/output/osx_plugin.c
index f7497ad3..a97f5698 100644
--- a/src/output/osx_plugin.c
+++ b/src/output/osx_plugin.c
@@ -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;
diff --git a/src/timer.c b/src/timer.c
index 3cb497a1..7293f9f4 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -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);
}
diff --git a/src/utils.c b/src/utils.c
index ce9a09f7..7705cf79 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -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
diff --git a/src/utils.h b/src/utils.h
index d3fb7a61..d20f0b4f 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -28,8 +28,6 @@
} while (0)
#endif /* !assert_static */
-void my_usleep(long usec);
-
char *parsePath(char *path);
int set_nonblocking(int fd);