package riot

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file uid.ml

1
2
3
4
5
6
7
8
9
10
11
type t = int64

let __current__ = Atomic.make 0L

let rec next () =
  let last = Atomic.get __current__ in
  let current = Int64.succ last in
  if Atomic.compare_and_set __current__ last current then last else next ()

let equal a b = Int64.equal a b
let pp ppf t = Format.fprintf ppf "%s" (Int64.to_string t)
OCaml

Innovation. Community. Security.