Skip to content

Commit

Permalink
Merge pull request #229 from edwintorok/master
Browse files Browse the repository at this point in the history
Remove Lazy from native and bytecode modes: not thread safe and sometimes SIGSEGV
  • Loading branch information
seliopou authored Sep 11, 2024
2 parents aff4665 + 63836d8 commit 69e166a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/angstrom.ml
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,14 @@ let take_till f =
let choice ?(failure_msg="no more choices") ps =
List.fold_right (<|>) ps (fail failure_msg)

let notset = { run = fun _buf _pos _more _fail _succ -> failwith "Angstrom.fix_direct not set" }

let fix_direct f =
let rec p = lazy (f r)
let rec p = ref notset
and r = { run = fun buf pos more fail succ ->
(Lazy.force p).run buf pos more fail succ }
(!p).run buf pos more fail succ }
in
p := f r;
r

let fix_lazy ~max_steps f =
Expand Down

0 comments on commit 69e166a

Please sign in to comment.