summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2022-04-14 23:14:27 +0200
committerMarton Balint <cus@passwd.hu>2022-04-22 21:58:47 +0200
commit58aa06bea01c7d5a4ed06c502838a31d518f6a6b (patch)
treeab71e70055a770ebe217854d3adc0f34a11451cc /libavutil
parentfbd22504c4148d2a01ccfe38df26c144f56db76b (diff)
avutil/cpu: #define _GNU_SOURCE before including any standard headers
Otherwise its effect might not work causing CPU_COUNT to not get defined. Fixes cpu count detection to actually use sched_getaffinity if available. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/cpu.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 833c220192..24b99d2554 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -16,6 +16,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
+
+#if HAVE_SCHED_GETAFFINITY
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+#include <sched.h>
+#endif
+
#include <stddef.h>
#include <stdint.h>
#include <stdatomic.h>
@@ -23,16 +32,9 @@
#include "attributes.h"
#include "cpu.h"
#include "cpu_internal.h"
-#include "config.h"
#include "opt.h"
#include "common.h"
-#if HAVE_SCHED_GETAFFINITY
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-#endif
-#include <sched.h>
-#endif
#if HAVE_GETPROCESSAFFINITYMASK || HAVE_WINRT
#include <windows.h>
#endif