summaryrefslogtreecommitdiff
path: root/jstests/parallel/checkMultiThread.js
blob: a6b92689beca033deb10c7c50d03707f7d9bf665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
load('jstests/libs/parallelTester.js');

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");