[libc-commits] [libc] [libc] Add an extension macro to get numerical thread id (PR #195202)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Tue May 5 11:46:48 PDT 2026


================
@@ -0,0 +1,19 @@
+//===-- Definition of threads macros --------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_MACROS_THREADS_MACRO_H
+#define LLVM_LIBC_MACROS_THREADS_MACRO_H
+
+#include "__llvm-libc-common.h"
+#include "stdint-macros.h"
+
+// LLVM libc extensions
+#define __THRD_GET_ID(t)                                                       \
----------------
petrhosek wrote:

I'd suggest making this function macro name lowercase, that gives us a flexibility to turn this into a function in the future if needed without having to change the name.
```suggestion
#define __thrd_get_id(t)                                                       \
```

https://github.com/llvm/llvm-project/pull/195202


More information about the libc-commits mailing list