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/os.h" | 7 #include "vm/os.h" |
8 #include "vm/port.h" | 8 #include "vm/port.h" |
9 #include "vm/unit_test.h" | 9 #include "vm/unit_test.h" |
10 | 10 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 Isolate* isolate = Isolate::Current(); | 199 Isolate* isolate = Isolate::Current(); |
200 PortMessage* result = isolate->message_queue()->Dequeue(0); | 200 PortMessage* result = isolate->message_queue()->Dequeue(0); |
201 return result; | 201 return result; |
202 } | 202 } |
203 | 203 |
204 | 204 |
205 void ThreadedPort_start(uword parameter) { | 205 void ThreadedPort_start(uword parameter) { |
206 // We only need an isolate here because the MutexLocker in | 206 // We only need an isolate here because the MutexLocker in |
207 // PortMap::CreatePort expects it, we don't need to initialize | 207 // PortMap::CreatePort expects it, we don't need to initialize |
208 // the isolate as it does not run any dart code. | 208 // the isolate as it does not run any dart code. |
209 Dart::CreateIsolate(); | 209 Dart::CreateIsolate(NULL); |
210 | 210 |
211 intptr_t remote = parameter; | 211 intptr_t remote = parameter; |
212 intptr_t local = PortMap::CreatePort(); | 212 intptr_t local = PortMap::CreatePort(); |
213 | 213 |
214 PortMap::PostMessage(remote, 0, AllocIntData(local)); | 214 PortMap::PostMessage(remote, 0, AllocIntData(local)); |
215 | 215 |
216 intptr_t count = 0; | 216 intptr_t count = 0; |
217 while (true) { | 217 while (true) { |
218 PortMessage* msg = NextMessage(); | 218 PortMessage* msg = NextMessage(); |
219 EXPECT_EQ(local, msg->dest_port()); | 219 EXPECT_EQ(local, msg->dest_port()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // Give the spawned thread enough time to properly exit. | 263 // Give the spawned thread enough time to properly exit. |
264 Monitor* waiter = new Monitor(); | 264 Monitor* waiter = new Monitor(); |
265 { | 265 { |
266 MonitorLocker ml(waiter); | 266 MonitorLocker ml(waiter); |
267 ml.Wait(20); | 267 ml.Wait(20); |
268 } | 268 } |
269 delete waiter; | 269 delete waiter; |
270 } | 270 } |
271 | 271 |
272 } // namespace dart | 272 } // namespace dart |
OLD | NEW |