github ↗
docs menu

Module Rig_amd.Lock

#type t

The type for a path's locks.

#val create : unit -> t

create () is a new lock. A thread may take it while it holds an image's lock, a device's, or rig.pci's driver lock or a hold's (Rig_pci.Driver), and may take rig.pci's memory locks while it holds it.

#val protect : t -> (unit -> 'a) -> 'a

protect l f is f () run holding l, which it gives back as f returns or raises.

Raises Invalid_argument, having taken nothing, if the calling thread holds l, as a callback that interrupts a section does.

#val guarded : string -> (unit -> 'a) -> 'a

guarded fn f is f () run with the calling thread's signals blocked but inside the path's waits, except on Windows, where OCaml has no signal masks and it blocks none. It raises Invalid_argument, naming fn, having run nothing, if the calling thread holds a lock of rig's or of a driver's. A path's opener's make and its public functions that may take a lock run their whole body inside it (Drivers).