Commit 521afe16 authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

Fix Mac llvm-gcc42 build after commit r16473.

TBR=machenbach@chromium.org

Review URL: https://codereview.chromium.org/23437020

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16474 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fead0d06
...@@ -36,27 +36,28 @@ ...@@ -36,27 +36,28 @@
using namespace ::v8::internal; using namespace ::v8::internal;
TEST(WaitAndSignal) { class WaitAndSignalThread V8_FINAL : public Thread {
class WaitAndSignalThread V8_FINAL : public Thread { public:
public: explicit WaitAndSignalThread(Semaphore* semaphore)
explicit WaitAndSignalThread(Semaphore* semaphore) : Thread("WaitAndSignalThread"), semaphore_(semaphore) {}
: Thread("WaitAndSignalThread"), semaphore_(semaphore) {} virtual ~WaitAndSignalThread() {}
virtual ~WaitAndSignalThread() {}
virtual void Run() V8_OVERRIDE {
virtual void Run() V8_OVERRIDE { for (int n = 0; n < 1000; ++n) {
for (int n = 0; n < 1000; ++n) { semaphore_->Wait();
semaphore_->Wait(); bool result = semaphore_->WaitFor(TimeDelta::FromMicroseconds(1));
bool result = semaphore_->WaitFor(TimeDelta::FromMicroseconds(1)); ASSERT(!result);
ASSERT(!result); USE(result);
USE(result); semaphore_->Signal();
semaphore_->Signal();
}
} }
}
private:
Semaphore* semaphore_;
};
private:
Semaphore* semaphore_;
};
TEST(WaitAndSignal) {
Semaphore semaphore(0); Semaphore semaphore(0);
WaitAndSignalThread t1(&semaphore); WaitAndSignalThread t1(&semaphore);
WaitAndSignalThread t2(&semaphore); WaitAndSignalThread t2(&semaphore);
...@@ -93,8 +94,10 @@ TEST(WaitFor) { ...@@ -93,8 +94,10 @@ TEST(WaitFor) {
// Semaphore signalled - no timeout. // Semaphore signalled - no timeout.
semaphore.Signal(); semaphore.Signal();
ok = semaphore.WaitFor(TimeDelta::FromMicroseconds(0)); ok = semaphore.WaitFor(TimeDelta::FromMicroseconds(0));
CHECK(ok);
semaphore.Signal(); semaphore.Signal();
ok = semaphore.WaitFor(TimeDelta::FromMicroseconds(100)); ok = semaphore.WaitFor(TimeDelta::FromMicroseconds(100));
CHECK(ok);
semaphore.Signal(); semaphore.Signal();
ok = semaphore.WaitFor(TimeDelta::FromMicroseconds(1000)); ok = semaphore.WaitFor(TimeDelta::FromMicroseconds(1000));
CHECK(ok); CHECK(ok);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment