OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4691 | 4691 |
4692 | 4692 |
4693 // Multithreaded tests of JSON debugger protocol | 4693 // Multithreaded tests of JSON debugger protocol |
4694 | 4694 |
4695 // Support classes | 4695 // Support classes |
4696 | 4696 |
4697 // Provides synchronization between N threads, where N is a template parameter. | 4697 // Provides synchronization between N threads, where N is a template parameter. |
4698 // The Wait() call blocks a thread until it is called for the Nth time, then all | 4698 // The Wait() call blocks a thread until it is called for the Nth time, then all |
4699 // calls return. Each ThreadBarrier object can only be used once. | 4699 // calls return. Each ThreadBarrier object can only be used once. |
4700 template <int N> | 4700 template <int N> |
4701 class ThreadBarrier V8_FINAL { | 4701 class ThreadBarrier FINAL { |
4702 public: | 4702 public: |
4703 ThreadBarrier() : num_blocked_(0) {} | 4703 ThreadBarrier() : num_blocked_(0) {} |
4704 | 4704 |
4705 ~ThreadBarrier() { | 4705 ~ThreadBarrier() { |
4706 LockGuard<Mutex> lock_guard(&mutex_); | 4706 LockGuard<Mutex> lock_guard(&mutex_); |
4707 if (num_blocked_ != 0) { | 4707 if (num_blocked_ != 0) { |
4708 CHECK_EQ(N, num_blocked_); | 4708 CHECK_EQ(N, num_blocked_); |
4709 } | 4709 } |
4710 } | 4710 } |
4711 | 4711 |
(...skipping 2688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7400 v8::Isolate* isolate = env->GetIsolate(); | 7400 v8::Isolate* isolate = env->GetIsolate(); |
7401 v8::HandleScope scope(isolate); | 7401 v8::HandleScope scope(isolate); |
7402 v8::Debug::SetDebugEventListener(DebugBreakTriggerTerminate); | 7402 v8::Debug::SetDebugEventListener(DebugBreakTriggerTerminate); |
7403 TerminationThread terminator(isolate); | 7403 TerminationThread terminator(isolate); |
7404 terminator.Start(); | 7404 terminator.Start(); |
7405 v8::TryCatch try_catch; | 7405 v8::TryCatch try_catch; |
7406 v8::Debug::DebugBreak(isolate); | 7406 v8::Debug::DebugBreak(isolate); |
7407 CompileRun("while (true);"); | 7407 CompileRun("while (true);"); |
7408 CHECK(try_catch.HasTerminated()); | 7408 CHECK(try_catch.HasTerminated()); |
7409 } | 7409 } |
OLD | NEW |