terminal user interface to jujutsu. Focused on speed and clarity
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

cleanup unneeded lock_all code

Eli Dowling b1815d08 16f9a71c

+1 -62
+1 -16
forks/lwd/lib/lwd/mutex_backend.ml
··· 7 7 val unlock : t -> unit 8 8 val try_lock : t -> bool 9 9 val protect : t -> (unit -> 'a) -> 'a 10 - val lock_all : t list -> bool 11 10 end 12 11 13 12 module Stdlib : MUTEX = struct 14 13 include Mutex 15 14 16 - let lock_all mutexes = 17 - let rec try_lock_all acc = function 18 - | [] -> 19 - (* All mutexes acquired successfully *) 20 - true 21 - | mutex :: rest -> 22 - if try_lock mutex then 23 - try_lock_all (mutex :: acc) rest 24 - else begin 25 - (* Failed to acquire current mutex, release all previously acquired ones *) 26 - List.iter unlock acc; 27 - false 28 - end 29 - in 30 - try_lock_all [] mutexes 15 + 31 16 end 32 17 33 18 (* Picos implementation - only available if picos is linked *)
-16
forks/lwd/lib/lwd/mutex_stdlib.ml
··· 1 1 (** OCaml standard library implementation of the mutex interface. *) 2 2 3 3 include Mutex 4 - 5 - let lock_all mutexes = 6 - let rec try_lock_all acc = function 7 - | [] -> 8 - (* All mutexes acquired successfully *) 9 - true 10 - | mutex :: rest -> 11 - if try_lock mutex then 12 - try_lock_all (mutex :: acc) rest 13 - else begin 14 - (* Failed to acquire current mutex, release all previously acquired ones *) 15 - List.iter unlock acc; 16 - false 17 - end 18 - in 19 - try_lock_all [] mutexes
-15
forks/lwd/lib/lwd_picos/mutex_picos.ml
··· 18 18 let try_lock mut = try_lock mut 19 19 let protect mut f = protect mut f 20 20 21 - let lock_all mutexes = 22 - let rec try_lock_all acc = function 23 - | [] -> 24 - (* All mutexes acquired successfully *) 25 - true 26 - | mutex :: rest -> 27 - if try_lock mutex then 28 - try_lock_all (mutex :: acc) rest 29 - else begin 30 - (* Failed to acquire current mutex, release all previously acquired ones *) 31 - List.iter unlock acc; 32 - false 33 - end 34 - in 35 - try_lock_all [] mutexes
-15
forks/lwd/lib/lwd_stdlib/mutex_stdlib.ml
··· 2 2 3 3 include Mutex 4 4 5 - let lock_all mutexes = 6 - let rec try_lock_all acc = function 7 - | [] -> 8 - (* All mutexes acquired successfully *) 9 - true 10 - | mutex :: rest -> 11 - if try_lock mutex then 12 - try_lock_all (mutex :: acc) rest 13 - else begin 14 - (* Failed to acquire current mutex, release all previously acquired ones *) 15 - List.iter unlock acc; 16 - false 17 - end 18 - in 19 - try_lock_all [] mutexes