Use a constructor in benchutil/alarm
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 12 Aug 2016 20:50:39 +0000 (16:50 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 12 Aug 2016 21:35:14 +0000 (17:35 -0400)
commit0ae4aef2c28186f85a50c8b4abc671333eba0ab5
tree663acda80261d7d3b8836887b8c5f2b246d053fb
parent743b8b02f8acab58deac22fdc307df36c3737fa3
Use a constructor in benchutil/alarm

It's possible to race with multiple threads (or vcore context) setting up
awaiters at the same time.  The nicer approach, and one that avoids a lot
of work in vcore context, is to use a constructor.

Programs that *might* call the alarm code (thus link and trigger the
constructor) will pay the setup tax (opening FDs, etc), instead of delaying
that setup cost until when we *know* they will use the alarms.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/benchutil/alarm.c