Timer
Summary:
This adds a Timer util which allows you to schedule a callback when a
timer fires. Since this uses `Unix.setitimer`, it won't work on Windows.
I intend to use this in two ways:
I'll update `Timeout.Alarm_timeout` to use this, since `Alarm_timeout` has
this old bug where nesting timeouts don't quite work correctly (the outer
timout gets paused while the inner one runs). This is a necessary change, since
you can't have two utils both use sigalrm.
I also want to use this for profiling. I want to sample cpu/memory/etc
repeatedly and this seems like a good way to do so.
Reviewed By: alexchow
Differential Revision:
D5227380
fbshipit-source-id:
d8c9c6a2da6f0bdde3173ab2fe4b921bac4dfaf6