summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2011-01-05 19:22:21 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:12:52 -0300
commit9d16874b68af3b77d97613e579c83ac19590293f (patch)
tree98a792e37e3aedd2cd9c95a5d966d7c6f1b82748
parentb2c20708545f7992f337c3be4c8595f7fb848a07 (diff)
Use sleep function to give time to process breath.sb-1.0.0-beta3
Fixes bug #580 Reviewer: Lauro Moura <lauro.neto@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
-rw-r--r--tests/libsample/bucket.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/libsample/bucket.cpp b/tests/libsample/bucket.cpp
index b69ac7ec..b31ae1b4 100644
--- a/tests/libsample/bucket.cpp
+++ b/tests/libsample/bucket.cpp
@@ -23,6 +23,15 @@
#include "bucket.h"
#include <iostream>
+#ifdef _WIN32 // _WIN32 is defined by all Windows 32 and 64 bit compilers, but not by others.
+#include <windows.h>
+#define SLEEP(x) Sleep(x)
+#else
+#include <unistd.h>
+#define SLEEP(x) usleep(x)
+#endif
+
+
using namespace std;
Bucket::Bucket() : m_locked(false)
@@ -54,7 +63,7 @@ bool Bucket::empty()
void Bucket::lock()
{
m_locked = true;
- while (m_locked);
+ while (m_locked) { SLEEP(300); }
}
void Bucket::unlock()