Skip to content

Commit

Permalink
Reinstate and deprecate original transaction function
Browse files Browse the repository at this point in the history
To reduce disruption to existing users of the transaction function,
this commit replaces the original function (alongside the new
alternatives) and adds comments to say it is deprecated and to
warn explicitly about its potential to retry for ever.

Signed-off-by: Thomas Sanders <thomas.sanders@citrix.com>
  • Loading branch information
thomassa committed May 8, 2017
1 parent 72f0971 commit f706c98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client_unix/xs_client_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -406,5 +406,11 @@ module Client = functor(IO: IO with type 'a t = 'a) -> struct
with Eagain when (attempts > 1) ->
transaction_attempts (attempts-1) client f

(** Deprecated: retries for ever on repeated Eagain *)
let rec transaction client f =
let (h, result) = _transaction_leave_open client f in
try _commit h result
with Eagain -> transaction client f

end

6 changes: 6 additions & 0 deletions client_unix/xs_client_unix.mli
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ module Client : functor(IO: IO) -> sig
attempts. If the last of those fails with a conflict, the Eagain
exception will be raised to the caller. *)

val transaction : client -> (handle -> 'a IO.t) -> 'a IO.t
(** DEPRECATED!
Access xenstore with a single transaction. On conflict the
operation will be repeated INDEFINITELY, with no guarantee
of eventual success or termination. *)

val wait : client -> (handle -> 'a IO.t) -> 'a Task.u
(** Wait for some condition to become true and return a value. The
function argument should throw Eagain if the condition is not
Expand Down

0 comments on commit f706c98

Please sign in to comment.