Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrm committed Nov 3, 2023
1 parent be18aad commit 6699df5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src_lockfree/michael_scott_queue.mli
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ val pop : 'a t -> 'a
@raise Empty if [q] is empty. *)

val pop_opt : 'a t -> 'a option
(** [pop q] removes and returns the first element in queue [q], or
(** [pop_opt q] removes and returns the first element in queue [q], or
returns [None] if the queue is empty. *)

val peek : 'a t -> 'a
Expand All @@ -55,7 +55,7 @@ val peek : 'a t -> 'a
@raise Empty if [q] is empty. *)

val peek_opt : 'a t -> 'a option
(** [peek q] returns the first element in queue [q], or
(** [peek_opt q] returns the first element in queue [q], or
returns [None] if the queue is empty. *)

type 'a cursor
Expand Down
3 changes: 2 additions & 1 deletion test/michael_scott_queue/michael_scott_queue_dscheck.ml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ let two_domains () =
(fun elt ->
(* even nums belong to thr 1, odd nums to thr 2 *)
Michael_scott_queue.push stack elt;
lpop := Option.get (Michael_scott_queue.pop_opt stack) :: !lpop)
lpop :=
Option.get (Michael_scott_queue.pop_opt stack) :: !lpop)
lpush)
|> ignore)
lists;
Expand Down
8 changes: 4 additions & 4 deletions test/michael_scott_queue/qcheck_michael_scott_queue.ml
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ let tests_two_domains =
(* TEST 1 - two domains doing multiple times one push then one pop_opt.
Parallel [push] and [pop_opt].
*)
Test.make ~name:"parallel_pop_opt_push"
(pair small_nat small_nat) (fun (npush1, npush2) ->
Test.make ~name:"parallel_pop_opt_push" (pair small_nat small_nat)
(fun (npush1, npush2) ->
(* Initialization *)
let queue = create () in
let barrier = Barrier.create 2 in
Expand Down Expand Up @@ -202,8 +202,8 @@ let tests_two_domains =
Two domains randomly pushs and pops in parallel. They stop as
soon as they have finished pushing a list of element to
push. *)
Test.make ~name:"parallel_pop_opt_push_random"
(pair small_nat small_nat) (fun (npush1, npush2) ->
Test.make ~name:"parallel_pop_opt_push_random" (pair small_nat small_nat)
(fun (npush1, npush2) ->
(* Initialization *)
let queue = create () in
let barrier = Barrier.create 2 in
Expand Down
2 changes: 1 addition & 1 deletion test/mpsc_queue/stm_mpsc_queue.ml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module MPSCConf = struct
(is_closed, if not is_closed then i :: List.rev s |> List.rev else s)
| Push_head i -> (is_closed, if not (is_closed && s = []) then i :: s else s)
| Is_empty -> (is_closed, s)
| Pop -> ( (is_closed, match s with [] -> s | _ :: s' -> s'))
| Pop -> (is_closed, match s with [] -> s | _ :: s' -> s')
| Peek -> (is_closed, s)
| Close -> (true, s)

Expand Down

0 comments on commit 6699df5

Please sign in to comment.