Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: lib/os/os.dart

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/os/native_process.dart ('k') | lib/service/service.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library dart.fletch.os; 5 library dart.dartino.os;
6 6
7 import 'dart:fletch._system' as fletch; 7 import 'dart:dartino._system' as dartino;
8 import 'dart:fletch'; 8 import 'dart:dartino';
9 import 'dart:fletch.ffi'; 9 import 'dart:dartino.ffi';
10 10
11 part 'native_process.dart'; 11 part 'native_process.dart';
12 part 'event_handler.dart'; 12 part 'event_handler.dart';
13 13
14 final ForeignFunction _nanosleep = ForeignLibrary.main.lookup("nanosleep"); 14 final ForeignFunction _nanosleep = ForeignLibrary.main.lookup("nanosleep");
15 15
16 class _Timespec extends Struct { 16 class _Timespec extends Struct {
17 _Timespec() : super(2); 17 _Timespec() : super(2);
18 int get tv_sec => getField(0); 18 int get tv_sec => getField(0);
19 int get tv_nsec => getField(1); 19 int get tv_nsec => getField(1);
20 void set tv_sec(int value) => setField(0, value); 20 void set tv_sec(int value) => setField(0, value);
21 void set tv_nsec(int value) => setField(1, value); 21 void set tv_nsec(int value) => setField(1, value);
22 } 22 }
23 23
24 // Sleep is still here and not in package:os, as it is used in async_patch.dart. 24 // Sleep is still here and not in package:os, as it is used in async_patch.dart.
25 void sleep(int milliseconds) { 25 void sleep(int milliseconds) {
26 _Timespec timespec = new _Timespec(); 26 _Timespec timespec = new _Timespec();
27 timespec.tv_sec = milliseconds ~/ 1000; 27 timespec.tv_sec = milliseconds ~/ 1000;
28 timespec.tv_nsec = (milliseconds % 1000) * 1000000; 28 timespec.tv_nsec = (milliseconds % 1000) * 1000000;
29 int result; 29 int result;
30 try { 30 try {
31 result = _nanosleep.icall$2Retry(timespec, timespec); 31 result = _nanosleep.icall$2Retry(timespec, timespec);
32 } finally { 32 } finally {
33 timespec.free(); 33 timespec.free();
34 } 34 }
35 if (result != 0) throw "Failed to call 'nanosleep': ${Foreign.errno}"; 35 if (result != 0) throw "Failed to call 'nanosleep': ${Foreign.errno}";
36 } 36 }
OLDNEW
« no previous file with comments | « lib/os/native_process.dart ('k') | lib/service/service.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698