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>
This commit is contained in:
Marton Balint 2022-04-14 23:14:27 +02:00
parent fbd22504c4
commit 58aa06bea0
1 changed files with 11 additions and 9 deletions

View File

@ -16,16 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stddef.h>
#include <stdint.h>
#include <stdatomic.h>
#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
@ -33,6 +24,17 @@
#endif
#include <sched.h>
#endif
#include <stddef.h>
#include <stdint.h>
#include <stdatomic.h>
#include "attributes.h"
#include "cpu.h"
#include "cpu_internal.h"
#include "opt.h"
#include "common.h"
#if HAVE_GETPROCESSAFFINITYMASK || HAVE_WINRT
#include <windows.h>
#endif