summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2011-01-05 19:22:21 -0300
committerRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2011-01-05 19:22:21 -0300
commit20f57828674fabc0ef1b5f0fbcea7c8732477979 (patch)
tree7c950e78c0c7bbd93fb5aaaed23be89dc2676854
parent786da143a916a81d11ba7bc4f14af71f6893584c (diff)
downloadshiboken-20f57828674fabc0ef1b5f0fbcea7c8732477979.tar.gz
shiboken-20f57828674fabc0ef1b5f0fbcea7c8732477979.tar.xz
shiboken-20f57828674fabc0ef1b5f0fbcea7c8732477979.zip
Use sleep function to give time to process breath.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()