Opened 3 years ago
Closed 3 years ago
#17521 closed enhancement (fixed)
Add C11 Thread support (easy)
Reported by: | kallisti5 | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta4 |
Component: | System/POSIX | Version: | R1/beta3 |
Keywords: | C11 | Cc: | |
Blocked By: | Blocking: | ||
Platform: | All |
Description
Mesa was asking about us getting C11 threads. From what I can tell we don't offer this today.
C11 Threads POSIX Threads thrd_create() pthread_create() thrd_current() pthread_self() thrd_detach() pthread_detach() thrd_equal() pthread_equal() thrd_exit() pthread_exit() thrd_join() pthread_join()
Today we offer BeOS native things like thread_id find_thread(const char *name); , and POSIX threads like pthread_t pthread_self(void);
Change History (10)
comment:1 by , 3 years ago
comment:2 by , 3 years ago
probably :-)
http://open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3631.pdf
Getting the C11 Standard C11 and C++11 are available from the ANSI store. For C11, use this link: http://webstore.ansi.org/RecordDetail.aspx?sku=INCITS%2fISO%2fIEC+9899‐2012. For C++11, use this link: http://webstore.ansi.org/RecordDetail.aspx?sku=INCITS%2fISO%2fIEC+14882‐2012 . Each costs $30 USD for PDF. The whole process takes only a few minutes.
hm.
comment:5 by , 3 years ago
oof. $60 each.
https://webstore.ansi.org/Standards/INCITS/INCITSISOIEC98992012 https://webstore.ansi.org/Standards/INCITS/INCITSISOIEC148822012
Reverse engineering looking better and better :-D
comment:7 by , 3 years ago
Apparently this does not require anything specific in GCC, so we should be able to copy an implementation from a C library as we usually do (glibc 2.28 or later, or *BSD or musl).
musl has some thrd_* things: https://git.musl-libc.org/cgit/musl/tree/src/thread/thrd_create.c , it seems to call into musl internals directly FreeBSD docs: https://www.freebsd.org/cgi/man.cgi?query=thrd_create&apropos=0&sektion=0&arch=default&format=html says they implement it as "a thin wrapper over pthreds" so that may be easy to reuse
comment:8 by , 3 years ago
It looks like we just need this one file from FreeBSD: https://xref.landonf.org/source/xref/freebsd-current/lib/libstdthreads/
comment:9 by , 3 years ago
Summary: | Add C11 Thread support → Add C11 Thread support (easy) |
---|
comment:10 by , 3 years ago
Milestone: | Unscheduled → R1/beta4 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Applied in hrev56041.
I guess there are some types as well?