greg7mdp / parallel-hashmap

A family of header-only, very fast and memory-friendly hashmap and btree containers.
https://greg7mdp.github.io/parallel-hashmap/
Apache License 2.0
2.47k stars 234 forks source link

Abseil Mutex uses Lock and Unlock, rather than lock and unlock #147

Closed evan-swinney closed 2 years ago

evan-swinney commented 2 years ago

As the title says, Abseil's absl::Mutex uses capitalized Lock() and Unlock(), rather than lock() and unlock(). This was a rather annoying find while I was benchmarking various different mutex implementations with parallel_flat_hash_map.

I was testing with Abseil version 20211102.0 via Conan. I didn't check how far back the capitalization change originates from.

If needed, here's a snippet from GCC11:

/parallel_hashmap/phmap_base.h:4816:17: error: ‘using mutex_type = class absl::lts_20211102::Mutex’ {aka ‘class absl::lts_20211102::Mutex’} has no member named ‘lock’; did you mean ‘Lock’?
 4816 |             m_->lock();
      |             ~~~~^~~~
      |             Lock
greg7mdp commented 2 years ago

Hi @evan-swinney , please use phmap::AbslMutex (defined in phmap_base.h) which adapts the abseil mutex to the standard interface.