diff options
Diffstat (limited to 'tests/auto/qsharedmemory/lackey/scripts/consumer.js')
-rw-r--r-- | tests/auto/qsharedmemory/lackey/scripts/consumer.js | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/tests/auto/qsharedmemory/lackey/scripts/consumer.js b/tests/auto/qsharedmemory/lackey/scripts/consumer.js deleted file mode 100644 index 4d12dca..0000000 --- a/tests/auto/qsharedmemory/lackey/scripts/consumer.js +++ /dev/null @@ -1,41 +0,0 @@ -function QVERIFY(x, debugInfo) { - if (!(x)) { - print(debugInfo); - throw(debugInfo); - } -} - -var consumer = new ScriptSharedMemory; -consumer.setKey("market"); - -//print("consumer starting"); -var tries = 0;; -while(!consumer.attach()) { - if (tries == 5000) { - var message = "consumer exiting, waiting too long"; - print(message); - throw(message); - } - ++tries; - consumer.sleep(1); -} -//print("consumer attached"); - - -var i = 0; -while(true) { - QVERIFY(consumer.lock(), "lock"); - if (consumer.get(0) == 'Q') { - consumer.set(0, ++i); - //print ("consumer sets" + i); - } - if (consumer.get(0) == 'E') { - QVERIFY(consumer.unlock(), "unlock"); - break; - } - QVERIFY(consumer.unlock(), "unlock"); - consumer.sleep(10); -} - -//print("consumer detaching"); -QVERIFY(consumer.detach()); |