[Openmp-commits] [PATCH] D19878: Use C++11 atomics for ticket locks implementation

Jim Cownie via Openmp-commits openmp-commits at lists.llvm.org
Wed May 4 02:51:06 PDT 2016

jcownie added a subscriber: jcownie.
jcownie added a comment.

I have only made a top-level scan, so this needs more review. However, 
__kmp_baker_check should look like this

  static kmp_uint32
  __kmp_bakery_check(void *value, kmp_uint32 checker)
      return (std::atomic_load( (std::atomic<unsigned> *)value ) == checker);

Rather than having a test then returning TRUE or FALSE!

It would also be nice to reduce some of the code replication (e.g. kmp_wait_yield_4_ptr is identical to kmp_wait_yield_4 apart from the argument type [MIssing leading underscores since they cause underlining!] ). Either we should use a template (if we accept that this code is really C++ now), or even a macro for the whole function that is invoked with the function name and type is better than having the whole code duplicated.



More information about the Openmp-commits mailing list