[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

broken-test[fibers] 03 future sleep

| sleep calcTimerDelta |
sleep := [:ms| | future |
	future := Future new. future handle.
	[ future return ] valueDeferred: ms.
	future
].

calcTimerDelta := [:ms| | start |
	start := DateTime new.
	(sleep value: ms) wait.
	DateTime new - start
] future.

(calcTimerDelta value: 2000) resolve: [:err :val|
	self print: 'Set timer for 2000ms, waited ' ,val ,'ms'
]