Module Rig.Local
#
type 'a keyThe type for keys of values of type 'a kept per device.
new_key init is a key whose value on a device d is init d. A key is never freed, so a library must make its keys once, such as at a module's top level.
get k d is k's value on d. The first get of k on d runs init d and stores its result, which every later get answers. A get that finds its value takes no lock and allocates nothing.
init druns on the calling domain holding no lock of rig's, so it may call any of rig's functions,getof any key included.- Gets that race on a device with no value may each run
init d. The first value stored is kept and every get answers it, soinitmakes values of which a spare is harmless. - An
initthat getskondruns a nestedinit, whose value is stored first, so both gets answer it. - If
init draises,getraises it and stores nothing.
Raises Lost if d is lost.