Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Sort events properly.

Signed-off-by: John Else <john.else@citrix.com>
  • Loading branch information...
commit 8614fd8dc0c75e9a145c047d723db36c0fe8b073 1 parent f43f602
John Else authored

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. +5 2 ocaml/xenops/updates.ml
7 ocaml/xenops/updates.ml
@@ -160,9 +160,12 @@ module UpdateRecorder = functor(Ord: Map.OrderedType) -> struct
160 160 let get from t =
161 161 (* [from] is the id of the most recent event already seen *)
162 162 let before, after = M.partition (fun _ time -> time <= from) t.map in
163   - let xs, last = M.fold (fun key v (acc, m) -> key :: acc, max m v) after ([], from) in
  163 + let xs, last = M.fold (fun key v (acc, m) -> (key, v) :: acc, max m v) after ([], from) in
164 164 (* NB 'xs' must be in order so 'Barrier' requests don't permute *)
165   - List.rev xs, last
  165 + let xs = List.sort (fun (_, v1) (_, v2) -> compare v1 v2) xs
  166 + |> List.map fst
  167 + in
  168 + xs, last
166 169
167 170 let last_id t = t.next - 1
168 171

0 comments on commit 8614fd8

Please sign in to comment.
Something went wrong with that request. Please try again.