package grenier
A collection of various algorithms in OCaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
grenier-v0.12.tbz
sha256=b08e4c774ef72fc53c4fcee477e739d1beac9702079300daddf51ced9fa9cd26
sha512=984d92c51dac7b3f169cad595969a4fdbeb2be7b420ed1a85618d6adbb64af855cf2618d9bd0834e84d6734b99196944cab04435e1aeacad8cdfbc9a7f73d6d4
doc/src/grenier.orderme/order_managed.ml.html
Source file order_managed.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
open Order_list type order = t type t = { t : order; (* This strange dance with protect is to prevent the GC from collecting values in the middle of an operation. *) mutable protect: int; } let lock1 t = t.protect <- t.protect + 1 let unlock1 t = if t.protect = 0 then forget t.t; t.protect <- t.protect - 1 let lock2 t1 t2 = lock1 t1; lock1 t2 let unlock2 t1 t2 = unlock1 t1; unlock1 t2 let forget t = if t.protect = 0 then forget t.t else t.protect <- t.protect - 1 let is_valid t = lock1 t; let result = is_valid t.t in unlock1 t; result let root () = let t = {t = root (); protect = 0} in Gc.finalise forget t; t let after t = lock1 t; let t' = {t = after t.t; protect = 0} in Gc.finalise forget t'; unlock1 t; t' let before t = lock1 t; let t' = {t = before t.t; protect = 0} in Gc.finalise forget t'; unlock1 t; t' let same_order t1 t2 = lock2 t1 t2; let result = same_order t1.t t2.t in unlock2 t1 t2; result let compare t1 t2 = lock2 t1 t2; let result = compare t1.t t2.t in unlock2 t1 t2; result let cardinal t = lock1 t; let result = cardinal t.t in unlock1 t; result let unsafe_check t msg = lock1 t; unsafe_check t.t ("(Order_managed) " ^ msg); unlock1 t
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>