diff --git a/infer/src/backend/InferAnalyze.ml b/infer/src/backend/InferAnalyze.ml index 4d8af69da..1f13b2334 100644 --- a/infer/src/backend/InferAnalyze.ml +++ b/infer/src/backend/InferAnalyze.ml @@ -187,7 +187,6 @@ let analyze source_files_to_analyze = ~tasks:build_tasks_generator in let workers_stats = Tasks.Runner.run runner in - RestartScheduler.clean () ; let collected_stats = Array.fold workers_stats ~init:([], []) ~f:(fun ((backend_stats_list, gc_stats_list) as stats_list) stats_opt -> diff --git a/infer/src/backend/ProcLocker.ml b/infer/src/backend/ProcLocker.ml index 5aceb2faf..23805d060 100644 --- a/infer/src/backend/ProcLocker.ml +++ b/infer/src/backend/ProcLocker.ml @@ -7,8 +7,6 @@ open! IStd -exception UnlockNotLocked of Procname.t - let log_lock_time = BackendStats.add_to_proc_locker_lock_time let log_unlock_time = BackendStats.add_to_proc_locker_unlock_time @@ -31,8 +29,6 @@ let setup () = create_file locks_target -let clean () = () - let lock_of_filename filename = locks_dir ^/ filename let lock_of_procname pname = lock_of_filename (Procname.to_filename pname) @@ -40,7 +36,8 @@ let lock_of_procname pname = lock_of_filename (Procname.to_filename pname) let unlock pname = record_time_of ~log_f:log_unlock_time ~f:(fun () -> try Unix.unlink (lock_of_procname pname) - with Unix.Unix_error (Unix.ENOENT, _, _) -> raise (UnlockNotLocked pname) ) + with Unix.Unix_error (Unix.ENOENT, _, _) -> + Die.die InternalError "Tried to unlock not-locked pname: %a@\n" Procname.pp pname ) let try_lock pname = diff --git a/infer/src/backend/ProcLocker.mli b/infer/src/backend/ProcLocker.mli index 71c8e64e1..d1eb25803 100644 --- a/infer/src/backend/ProcLocker.mli +++ b/infer/src/backend/ProcLocker.mli @@ -7,8 +7,6 @@ open! IStd -exception UnlockNotLocked of Procname.t - val setup : unit -> unit (** This should be called once before trying to lock Anything. *) @@ -19,8 +17,4 @@ val unlock : Procname.t -> unit (** This will work as a cleanup function because after calling unlock all the workers that need an unlocked Proc should find it's summary already Cached. Throws if the lock had not been taken. *) -val clean : unit -> unit -(** This should be called when locks will no longer be used to remove any files or state that's not - necessary. *) - val is_locked : proc_filename:string -> bool diff --git a/infer/src/backend/RestartScheduler.ml b/infer/src/backend/RestartScheduler.ml index 1e15d51a1..c3e0f148c 100644 --- a/infer/src/backend/RestartScheduler.ml +++ b/infer/src/backend/RestartScheduler.ml @@ -127,5 +127,3 @@ let unlock pname = let setup () = if_restart_scheduler ProcLocker.setup - -let clean () = if_restart_scheduler ProcLocker.clean diff --git a/infer/src/backend/RestartScheduler.mli b/infer/src/backend/RestartScheduler.mli index 4b7163c0a..63367c626 100644 --- a/infer/src/backend/RestartScheduler.mli +++ b/infer/src/backend/RestartScheduler.mli @@ -8,8 +8,6 @@ open! IStd val setup : unit -> unit -val clean : unit -> unit - val lock_exn : Procname.t -> unit val unlock : Procname.t -> unit diff --git a/infer/src/unit/RestartSchedulerTests.ml b/infer/src/unit/RestartSchedulerTests.ml index e6b8bd3ba..4a8536439 100644 --- a/infer/src/unit/RestartSchedulerTests.ml +++ b/infer/src/unit/RestartSchedulerTests.ml @@ -30,7 +30,10 @@ let tests_wrapper _test_ctxt = (* When an unlock is performed over a non-locked Procname it fails *) try_lock a_pname |> ignore ; unlock a_pname ; - assert_raises (UnlockNotLocked a_pname) (fun () -> unlock a_pname)) + try + unlock a_pname ; + assert_failure "Should have raised an exception." + with Die.InferInternalError _ -> ()) let tests = "restart_scheduler_suite" >:: tests_wrapper