[libcxx-commits] [PATCH] D88599: [SystemZ][ZOS] Porting pthread_t related functionality within libc++ to z/OS

Marshall Clow via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 16 15:55:03 PDT 2020


mclow.lists added inline comments.


================
Comment at: libcxx/include/mutex:283
     size_t             __count_;
-    __thread_id        __id_;
+    __thread_t         __t_;
 public:
----------------
zibi wrote:
> mclow.lists wrote:
> > Can't make this change. This is an ABI break if `sizeof(__thread_id) != sizeof(__thread_t)`
> Yes, you are right and I noticed that as well but do we know for fact that there is a platform where sizeof(__thread_id) != sizeof(__thread_t) ? I compiled the following assertions with not issues on z/OS and RHEL 7.4.
> 
> ```
> static_assert(sizeof(__th.__get_id()) == sizeof(__th), "zibi trace __thread_id != __thread_t");
> ```
> 
> As a matter of  fact `__thread_id` is the same type as `__thread_t` until we discovered on z/OS that this can not be the case. If this is really no go I'm open for suggestions.
There are three different implementations in this file.
* One for pthreads
* One for C11 threads
* One for external threading API

On two of them, `__thread_id` is the same type as `__thread_t`.
On two of them, the type `__thread_t` is defined outside of libc++ (to be precise, `__thread_t` is a typedef for a type supplied by the OS). Neither of those cases require that type to be an integral type.

We have to keep all of these working.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88599/new/

https://reviews.llvm.org/D88599



More information about the libcxx-commits mailing list