Commit 44729d3e authored by Tristan Matthews's avatar Tristan Matthews

* #9782: use nanosleep instead of usleep

parent 318fba03
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "manager.h" #include "manager.h"
#include "noncopyable.h" #include "noncopyable.h"
#include "dbus/configurationmanager.h" #include "dbus/configurationmanager.h"
#include <ctime>
class AlsaThread : public ost::Thread { class AlsaThread : public ost::Thread {
public: public:
...@@ -107,7 +108,8 @@ bool AlsaLayer::openDevice(snd_pcm_t **pcm, const std::string &dev, snd_pcm_stre ...@@ -107,7 +108,8 @@ bool AlsaLayer::openDevice(snd_pcm_t **pcm, const std::string &dev, snd_pcm_stre
// Retry if busy, since dmix plugin may not have released the device yet // Retry if busy, since dmix plugin may not have released the device yet
for (int tries = 0; tries < MAX_RETRIES and err == -EBUSY; ++tries) { for (int tries = 0; tries < MAX_RETRIES and err == -EBUSY; ++tries) {
usleep(10000); const struct timespec req = {0, 10000000};
nanosleep(&req, 0);
err = snd_pcm_open(pcm, dev.c_str(), stream, 0); err = snd_pcm_open(pcm, dev.c_str(), stream, 0);
} }
......
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