package riot

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

Source file scheduler_uid.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
type t = int

let __current__ = Atomic.make 0

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

let equal a b = Int.equal a b
let pp ppf t = Format.fprintf ppf "%02d" t
let to_int t = t

let reset () =
  Log.debug (fun f -> f "Resetting Scheduler Uids");
  Atomic.set __current__ 0
OCaml

Innovation. Community. Security.