11 Commits

Author SHA1 Message Date
Nick Desaulniers
8a25398615
[libc] move pthread macros to dedicated header (#119286)
so that docgen can find our definitions.

Also eliminate the enums. POSIX is careful to call these "symbolic constants"
rather than specifically whether they are preprocessor macro defines or not.
Enums are useful to expressing mutual exclusion when the enum values are in
distinct enums which can improve type safety. Our enum values weren't using
that pattern though; they were all in one big anonymous enum.

Link:
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/pthread.h.html
Fixes: #88997
2024-12-10 09:00:06 -08:00
Schrodinger ZHU Yifan
41fecca97b
[libc] add rwlock (#94156) 2024-06-14 13:34:28 -07:00
Hendrik Hübner
485f9f5895
Reland: [libc][POSIX][pthreads] implemented missing pthread_rwlockattr functions (#93622)
New pull request for https://github.com/llvm/llvm-project/issues/89443

The previous PR was reverted after breaking fullbuild due to a missing
struct declaration, which I forgot to commit.

Reverts revert and adds the missing pthread_rwlockattr_getkind_np /
pthread_rwlockattr_setkind_np functions and tests respecitvely.
2024-05-30 11:27:50 -07:00
Schrodinger ZHU Yifan
27595c4bef
Revert "[libc][POSIX][pthreads] implemented missing pthread_rwlockattr functions" (#91966)
Reverts llvm/llvm-project#90249

Fullbuild is broken:
https://lab.llvm.org/buildbot/#/builders/163/builds/56501
2024-05-13 09:43:14 -04:00
Hendrik Hübner
d2676a7333
[libc][POSIX][pthreads] implemented missing pthread_rwlockattr functions (#90249)
Closes #89443

I added the two missing functions and respective test cases. Let me know
if anything needs changing.
2024-05-13 09:35:17 -04:00
Nick Desaulniers
06947b9f8d
[libc][POSIX][pthreads] implement pthread_condattr_t functions (#88987)
Implement:
- pthread_condattr_destroy
- pthread_condattr_getclock
- pthread_condattr_getpshared
- pthread_condattr_init
- pthread_condattr_setclock
- pthread_condattr_setpshared

Fixes: #88581
2024-04-17 09:31:29 -07:00
Nick Desaulniers
cdbec7baf1
[libc] fix up the use of angle includes in include/ (#86027)
Performed en-masse via:

    $ grep -rn "#include <ll" libc/include -l | \
      xargs perl -pi -e 's/#include <ll(.*)>/#include "ll$1"/'
    $ grep -rn "#include <__" libc/include -l | \
      xargs perl -pi -e 's/#include <__(.*)>/#include "__$1"/'

Link: #83463
Link: #83210
2024-03-22 08:24:08 -07:00
Alfred Persson Forsberg
c1ce7c8341 [libc] pthread.h.def: add PTHREAD_MUTEX_INITIALIZER
Adds PTHREAD_MUTEX_INITIALIZER for compiler-rt's builtins/emutls.c

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D156276
2023-07-25 16:47:15 -07:00
Siva Chandra Reddy
3367539010 [libc] Add implementation of pthread_once.
The existing thrd_once function has been refactored so that the
implementation can be shared between thrd_once and pthread_once
functions.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D134716
2022-09-28 06:54:48 +00:00
Siva Chandra Reddy
0258f56646 [libc] Add a definition of pthread_attr_t and its getters and setters.
Not all attributes have been added to phtread_attr_t in this patch. They
will be added gradually in future patches.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D123423
2022-04-11 16:08:49 +00:00
Siva Chandra Reddy
83f153ce34 [libc] Add pthread_mutexattr_t type and its setters and getters.
A simple implementation of the getters and setters has been added. More
logic can be added to them in future as required.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D122969
2022-04-04 18:11:12 +00:00