| OLD | NEW |
| 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 /// Simple test that timers and event-handlers work. | 5 /// Simple test that timers and event-handlers work. |
| 6 /// | 6 /// |
| 7 /// For now we have to run this manually. | 7 /// For now we have to run this manually. |
| 8 | 8 |
| 9 import "dart:fletch"; | 9 import "dart:dartino"; |
| 10 import "dart:fletch.ffi"; | 10 import "dart:dartino.ffi"; |
| 11 import "dart:fletch.os" hide sleep; | 11 import "dart:dartino.os" hide sleep; |
| 12 | 12 |
| 13 ForeignFunction ledOn = ForeignLibrary.main.lookup('BSP_LED_On'); | 13 ForeignFunction ledOn = ForeignLibrary.main.lookup('BSP_LED_On'); |
| 14 ForeignFunction ledOff = ForeignLibrary.main.lookup('BSP_LED_Off'); | 14 ForeignFunction ledOff = ForeignLibrary.main.lookup('BSP_LED_Off'); |
| 15 | 15 |
| 16 // How many timers to schedule. | 16 // How many timers to schedule. |
| 17 const int count = 3; | 17 const int count = 3; |
| 18 | 18 |
| 19 int nextExpectedTimer = count - 1; | 19 int nextExpectedTimer = count - 1; |
| 20 | 20 |
| 21 // Listens continuously for messages on port 1. | 21 // Listens continuously for messages on port 1. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 }); | 59 }); |
| 60 // Yield to let the newly created fiber start listening. | 60 // Yield to let the newly created fiber start listening. |
| 61 Fiber.yield(); | 61 Fiber.yield(); |
| 62 fibers.add(fiber); | 62 fibers.add(fiber); |
| 63 } | 63 } |
| 64 Fiber.yield(); | 64 Fiber.yield(); |
| 65 fibers.add(Fiber.fork(listenPort1)); | 65 fibers.add(Fiber.fork(listenPort1)); |
| 66 | 66 |
| 67 fibers.forEach((Fiber fiber) => fiber.join); | 67 fibers.forEach((Fiber fiber) => fiber.join); |
| 68 } | 68 } |
| OLD | NEW |