OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/isolate.h" | 6 #include "vm/isolate.h" |
| 7 #include "vm/lockers.h" |
7 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
8 #include "vm/profiler.h" | 9 #include "vm/profiler.h" |
9 #include "vm/thread.h" | |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 UNIT_TEST_CASE(Mutex) { | 13 UNIT_TEST_CASE(Mutex) { |
14 // This unit test case needs a running isolate. | 14 // This unit test case needs a running isolate. |
15 Isolate* isolate = Isolate::Init(NULL); | 15 Isolate* isolate = Isolate::Init(NULL); |
16 | 16 |
17 Mutex* mutex = new Mutex(); | 17 Mutex* mutex = new Mutex(); |
18 mutex->Lock(); | 18 mutex->Lock(); |
19 EXPECT_EQ(false, mutex->TryLock()); | 19 EXPECT_EQ(false, mutex->TryLock()); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 EXPECT_LT(attempts, kNumAttempts); | 70 EXPECT_LT(attempts, kNumAttempts); |
71 | 71 |
72 // The isolate shutdown and the destruction of the mutex are out-of-order on | 72 // The isolate shutdown and the destruction of the mutex are out-of-order on |
73 // purpose. | 73 // purpose. |
74 isolate->Shutdown(); | 74 isolate->Shutdown(); |
75 delete isolate; | 75 delete isolate; |
76 delete monitor; | 76 delete monitor; |
77 } | 77 } |
78 | 78 |
79 } // namespace dart | 79 } // namespace dart |
OLD | NEW |