ocaml-multicore / kcas

Software Transactional Memory for OCaml
https://ocaml-multicore.github.io/kcas/
ISC License
107 stars 10 forks source link

Fix `Hashtbl.clear` #160

Closed polytypic closed 9 months ago

polytypic commented 9 months ago

This PR adds a test for and fixes a logic bug in the Hashtbl. The clear operation replaced the internal buckets array with an empty array [||] and requested rehash of the table on the next mutation operation. Unfortunately there is of course no guarantee that the next operation is a mutation. This PR fixes that by simply creating the new buckets array directly in clear.

Thanks to @Lucccyo for reporting the issue!