summaryrefslogtreecommitdiff
path: root/jstests/parallel/checkMultiThread.js
blob: d43b1ae506641a5cc016747f0f64c3b7ece6c07f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13

var start = new Date();
print("start: " + start);
var func = function() { db.runCommand({$eval: "sleep(10000);", nolock: true}); return new Date();}
a = new ScopedThread( func );
b = new ScopedThread( func );
a.start();
b.start();
a.join();
b.join();
assert.lt( a.returnData().getMilliseconds(), start.getMilliseconds() + 15000, "A took more than 15s" );
assert.lt( b.returnData().getMilliseconds(), start.getMilliseconds() + 15000, "B took more than 15s" );