Skip to content

Commit eb945c8

Browse files
authored
[concurrency] Provide missing header file. (#37004)
HAVE_PTHREAD_H is supplied in this config file. The `__has_include` pattern is discouraged, but there is no other way of conditioning on `pthread_np.h`, which is required for `pthread_main_np` on OpenBSD. Therefore, use it, but call it out in a comment.
1 parent 51c96a4 commit eb945c8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

stdlib/public/Concurrency/Actor.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "swift/Runtime/ThreadLocal.h"
3535
#include "swift/ABI/Task.h"
3636
#include "swift/ABI/Actor.h"
37+
#include "llvm/Config/config.h"
3738
#include "llvm/ADT/PointerIntPair.h"
3839
#include "TaskPrivate.h"
3940

@@ -63,6 +64,11 @@
6364

6465
#if HAVE_PTHREAD_H
6566
#include <pthread.h>
67+
68+
// Only use __has_include since HAVE_PTHREAD_NP_H is not provided.
69+
#if __has_include(<pthread_np.h>)
70+
#include <pthread_np.h>
71+
#endif
6672
#endif
6773

6874
#if defined(_WIN32)

0 commit comments

Comments
 (0)