git: 89ca5cddec22 - main - thr_new: add a flag indicating that the thread is created by C runtime

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 31 May 2025 14:56:00 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=89ca5cddec22f5676e9f9a91c2adfdbc574c78ca

commit 89ca5cddec22f5676e9f9a91c2adfdbc574c78ca
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-05-30 11:25:17 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-05-31 14:55:24 +0000

    thr_new: add a flag indicating that the thread is created by C runtime
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
---
 lib/libthr/thread/thr_create.c | 2 +-
 sys/sys/thr.h                  | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/libthr/thread/thr_create.c b/lib/libthr/thread/thr_create.c
index 2ae7cf0cd7b2..84bbd36ed28d 100644
--- a/lib/libthr/thread/thr_create.c
+++ b/lib/libthr/thread/thr_create.c
@@ -160,7 +160,7 @@ _pthread_create(pthread_t * __restrict thread,
 	param.tls_size = sizeof(struct tcb);
 	param.child_tid = &new_thread->tid;
 	param.parent_tid = &new_thread->tid;
-	param.flags = 0;
+	param.flags = THR_C_RUNTIME;
 	if (new_thread->attr.flags & PTHREAD_SCOPE_SYSTEM)
 		param.flags |= THR_SYSTEM_SCOPE;
 	if (new_thread->attr.sched_inherit == PTHREAD_INHERIT_SCHED)
diff --git a/sys/sys/thr.h b/sys/sys/thr.h
index 5e83ec208f07..54766668c929 100644
--- a/sys/sys/thr.h
+++ b/sys/sys/thr.h
@@ -43,6 +43,7 @@ typedef __size_t	size_t;
 #define	THR_SUSPENDED		0x0001
 /* Create the system scope thread. */
 #define	THR_SYSTEM_SCOPE	0x0002
+#define	THR_C_RUNTIME		0x0004
 
 struct thr_param {
     void	(*start_func)(void *);	/* thread entry function. */