libdrgn/openmp.h
raw| 1 | // Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 | // SPDX-License-Identifier: LGPL-2.1-or-later |
| 3 | |
| 4 | #ifndef DRGN_OPENMP_H |
| 5 | #define DRGN_OPENMP_H |
| 6 | |
| 7 | #ifdef _OPENMP |
| 8 | #include <omp.h> // IWYU pragma: export |
| 9 | |
| 10 | extern int drgn_num_threads; |
| 11 | void drgn_init_num_threads(void); |
| 12 | #else |
| 13 | static inline int omp_get_thread_num(void) |
| 14 | { |
| 15 | return 0; |
| 16 | } |
| 17 | |
| 18 | #define drgn_num_threads 1 |
| 19 | static inline void drgn_init_num_threads(void) |
| 20 | { |
| 21 | } |
| 22 | #endif |
| 23 | |
| 24 | #endif /* DRGN_OPENMP_H */ |