Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use backoff library #117

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.

Next version:

- Move `Backoff` module to its own `backoff` package (@lyrm, @polytypic)
- Support padding to avoid false sharing (@polytypic)
- Pass through `?timeoutf` to blocking operations on data structures
(@polytypic)
Expand Down
1 change: 1 addition & 0 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
(description "A software transactional memory (STM) implementation based on an atomic lock-free multi-word compare-and-set (MCAS) algorithm enhanced with read-only compare operations and ability to block awaiting for changes.")
(depends
(ocaml (>= 4.13.0))
(backoff (>= 0.1.0))
(domain-local-await (>= 0.2.0))
(domain-local-timeout (>= 0.1.0))
(multicore-magic (>= 1.0.0))
Expand Down
1 change: 1 addition & 0 deletions kcas.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ bug-reports: "https://github.com/ocaml-multicore/kcas/issues"
depends: [
"dune" {>= "3.3"}
"ocaml" {>= "4.13.0"}
"backoff" {>= "0.1.0"}
"domain-local-await" {>= "0.2.0"}
"domain-local-timeout" {>= "0.1.0"}
"multicore-magic" {>= "1.0.0"}
Expand Down
54 changes: 0 additions & 54 deletions src/kcas/backoff.ml

This file was deleted.

48 changes: 0 additions & 48 deletions src/kcas/backoff.mli

This file was deleted.

2 changes: 0 additions & 2 deletions src/kcas/domain.ocaml4.ml

This file was deleted.

13 changes: 2 additions & 11 deletions src/kcas/dune
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
(library
(name kcas)
(public_name kcas)
(libraries domain-local-await domain-local-timeout multicore-magic))

(rule
(targets domain.ml)
(deps domain.ocaml4.ml)
(enabled_if
(< %{ocaml_version} 5.0.0))
(action
(progn
(copy domain.ocaml4.ml domain.ml))))
(libraries domain-local-await domain-local-timeout backoff multicore-magic))

(mdx
(package kcas)
(deps
(package kcas))
(preludes kcas.prelude.ml)
(libraries kcas domain_shims)
(libraries kcas backoff domain_shims)
(files kcas.mli))
2 changes: 0 additions & 2 deletions src/kcas/kcas.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ let fenceless_get = Atomic.get
let fenceless_set = Atomic.set
*)

module Backoff = Backoff

module Timeout = struct
exception Timeout

Expand Down
2 changes: 0 additions & 2 deletions src/kcas/kcas.mli
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@
can skip over these. The documentation links back to these modules where
appropriate. *)

module Backoff : module type of Backoff

(** Timeout support. *)
module Timeout : sig
exception Timeout
Expand Down
13 changes: 0 additions & 13 deletions test/kcas/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -348,18 +348,6 @@ let test_post_commit () =

(* *)

let test_backoff () =
let b = Backoff.create ~lower_wait_log:5 ~upper_wait_log:6 () in
assert (Backoff.get_wait_log b = 5);
let b = Backoff.once b in
assert (Backoff.get_wait_log b = 6);
let b = Backoff.once b in
assert (Backoff.get_wait_log b = 6);
let b = Backoff.reset b in
assert (Backoff.get_wait_log b = 5)

(* *)

let test_blocking () =
let state = Loc.make `Spawned in
let await state' =
Expand Down Expand Up @@ -674,7 +662,6 @@ let () =
[ Alcotest.test_case "" `Quick test_presort_and_is_in_log_xt ] );
("updates", [ Alcotest.test_case "" `Quick test_updates ]);
("post commit", [ Alcotest.test_case "" `Quick test_post_commit ]);
("backoff", [ Alcotest.test_case "" `Quick test_backoff ]);
("blocking", [ Alcotest.test_case "" `Quick test_blocking ]);
( "no unnecessary wakeups",
[ Alcotest.test_case "" `Quick test_no_unnecessary_wakeups ] );
Expand Down