summaryrefslogtreecommitdiffstats
path: root/src/usr/testcore/lib/synctest.H
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/testcore/lib/synctest.H')
-rw-r--r--src/usr/testcore/lib/synctest.H7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/usr/testcore/lib/synctest.H b/src/usr/testcore/lib/synctest.H
index 80b462c5d..e8b0ef1e0 100644
--- a/src/usr/testcore/lib/synctest.H
+++ b/src/usr/testcore/lib/synctest.H
@@ -33,6 +33,11 @@
#include <sys/task.h>
#include <sys/time.h>
+#include <kernel/timemgr.H>
+
+#define NS_PER_SEC (1000000ull)
+#define TEN_CTX_SWITCHES ((NS_PER_SEC/TimeManager::TIMESLICE_PER_SEC)*10)
+
class SyncTest: public CxxTest::TestSuite
{
public:
@@ -61,7 +66,7 @@ class SyncTest: public CxxTest::TestSuite
mutex_lock(&mutex);
task_create(func2, this);
task_create(func2, this);
- nanosleep(1,0);
+ nanosleep(0,TEN_CTX_SWITCHES);
mutex_unlock(&mutex);
barrier_wait(&barrier);
TS_TRACE("ALL THREADS ENDED");
OpenPOWER on IntegriCloud