Skip to content

Commit

Permalink
[multicore][topl] make lazy automaton thread safe
Browse files Browse the repository at this point in the history
Summary: Lazy evaluation is not thread safe, so a mutex is used.

Reviewed By: rgrig, jvillard

Differential Revision:
D67091750

Privacy Context Container: L1208441

fbshipit-source-id: 4a593d4b793c4f07eee959a487b9bee423df6eb6
  • Loading branch information
ngorogiannis authored and facebook-github-bot committed Dec 11, 2024
1 parent 76ce578 commit d036752
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion infer/src/topl/Topl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@

open! IStd

let mutex = Error_checking_mutex.create ()

let automaton =
lazy
(ToplAutomaton.make
(Config.topl_properties @ DataFlowQuery.convert_to_topl Config.data_flow_queries_on_topl) )


let automaton () = Lazy.force automaton
let automaton () = Error_checking_mutex.critical_section mutex ~f:(fun () -> Lazy.force automaton)

let is_active () =
Config.is_checker_enabled Topl
Expand Down

0 comments on commit d036752

Please sign in to comment.