Skip to content

Commit b930831

Browse files
committed
[concurrency] Provide missing header file.
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 a4e71aa commit b930831

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
@@ -25,6 +25,7 @@
2525
#include "swift/Runtime/ThreadLocal.h"
2626
#include "swift/ABI/Task.h"
2727
#include "swift/ABI/Actor.h"
28+
#include "llvm/Config/config.h"
2829
#include "llvm/ADT/PointerIntPair.h"
2930
#include "TaskPrivate.h"
3031

@@ -50,6 +51,11 @@
5051

5152
#if HAVE_PTHREAD_H
5253
#include <pthread.h>
54+
55+
// Only use __has_include since HAVE_PTHREAD_NP_H is not provided.
56+
#if __has_include(<pthread_np.h>)
57+
#include <pthread_np.h>
58+
#endif
5359
#endif
5460

5561
#if defined(_WIN32)

0 commit comments

Comments
 (0)