Last active
August 29, 2015 14:09
-
-
Save mockturtl/97c0e692034888524f74 to your computer and use it in GitHub Desktop.
Revisions
-
mockturtl revised this gist
Nov 14, 2014 . 1 changed file with 20 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,29 +1,31 @@ import 'dart:async'; Stopwatch mom = new Stopwatch(); Stopwatch dad = new Stopwatch(); Duration dur = new Duration(milliseconds: 400); Future mymom() async { if(mom.elapsed > dur){ print('mom cooks'); mom.reset(); } mymom(); } Future mydad() async { if(dad.elapsed > dur){ print('dad works'); dad.reset(); } mydad(); } main() { mom.start(); dad.start(); mymom(); mydad(); print('end of main'); } -
mockturtl created this gist
Nov 14, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ Stopwatch mom = new Stopwatch(); Stopwatch dad = new Stopwatch(); Duration dur = new Duration(seconds: 1); mymom() async { mom.start(); while(true){ if(mom.elapsed > dur){ print('mom cooks'); //obviously mom.reset(); } } } mydad() async { dad.start(); while(true){ if(dad.elapsed > dur){ print('dad works'); dad.reset(); } } } main() { mymom(); mydad(); print('also true'); }