| 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/message_queue.h" | 6 #include "vm/message_queue.h" |
| 7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
| 8 | 8 |
| 9 namespace dart { | 9 namespace dart { |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 // A thread which receives an expected sequence of messages. | 61 // A thread which receives an expected sequence of messages. |
| 62 static Monitor* sync = NULL; | 62 static Monitor* sync = NULL; |
| 63 static MessageQueue* shared_queue = NULL; | 63 static MessageQueue* shared_queue = NULL; |
| 64 void MessageReceiver_start(uword unused) { | 64 void MessageReceiver_start(uword unused) { |
| 65 // We only need an isolate here because the MonitorLocker in the | 65 // We only need an isolate here because the MonitorLocker in the |
| 66 // MessageQueue expects it, we don't need to initialize the isolate | 66 // MessageQueue expects it, we don't need to initialize the isolate |
| 67 // as it does not run any dart code. | 67 // as it does not run any dart code. |
| 68 Dart::CreateIsolate(); | 68 Dart::CreateIsolate(NULL); |
| 69 | 69 |
| 70 // Create a message queue and share it. | 70 // Create a message queue and share it. |
| 71 MessageQueue* queue = new MessageQueue(); | 71 MessageQueue* queue = new MessageQueue(); |
| 72 MessageQueueTestPeer peer(queue); | 72 MessageQueueTestPeer peer(queue); |
| 73 shared_queue = queue; | 73 shared_queue = queue; |
| 74 | 74 |
| 75 // Tell the other thread that the shared queue is ready. | 75 // Tell the other thread that the shared queue is ready. |
| 76 { | 76 { |
| 77 MonitorLocker ml(sync); | 77 MonitorLocker ml(sync); |
| 78 ml.Notify(); | 78 ml.Notify(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 227 |
| 228 EXPECT(!queue_peer.HasMessage()); | 228 EXPECT(!queue_peer.HasMessage()); |
| 229 queue.Flush(port1); | 229 queue.Flush(port1); |
| 230 | 230 |
| 231 // Queue is still empty. | 231 // Queue is still empty. |
| 232 EXPECT(!queue_peer.HasMessage()); | 232 EXPECT(!queue_peer.HasMessage()); |
| 233 } | 233 } |
| 234 | 234 |
| 235 | 235 |
| 236 } // namespace dart | 236 } // namespace dart |
| OLD | NEW |