win32/pthread: define _POSIX_TIMERS to notify they are not supported

This commit is contained in:
Kacper Michajłow 2023-09-17 00:37:15 +02:00 committed by Dudemanguy
parent 318b5471a1
commit cdfd5c280a
10 changed files with 11 additions and 8 deletions

View File

@ -69,8 +69,7 @@ struct stat_entry {
// Overflows only after I'm dead.
static int64_t get_thread_cpu_time_ns(pthread_t thread)
{
#if defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 && defined(_POSIX_THREAD_CPUTIME) && \
!HAVE_WIN32_INTERNAL_PTHREADS
#if defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 && defined(_POSIX_THREAD_CPUTIME)
clockid_t id;
struct timespec tv;
if (pthread_getcpuclockid(thread, &id) == 0 &&

View File

@ -17,6 +17,7 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include <pthread.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

View File

@ -17,6 +17,7 @@
#include "config.h"
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@ -28,7 +29,6 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <fcntl.h>
#include <pthread.h>
#include <assert.h>
#include "osdep/io.h"

View File

@ -357,9 +357,6 @@ win32_pthreads = get_option('win32-internal-pthreads').require(
features += {'win32-internal-pthreads': win32_pthreads.allowed()}
if features['win32-internal-pthreads']
flags += ['-isystem', '-I', '-DIN_WINPTHREAD']
# Note: Adding this include causes POSIX_TIMERS to be defined for
# unclear reasons (some confusion with <pthread.h> probably).
# Hack around it by using HAVE_WIN32_INTERNAL_PTHREADS.
includedir += include_directories('osdep/win32/include')
sources += files('osdep/win32/pthread.c')
else

View File

@ -20,6 +20,8 @@
#include <sys/types.h>
#define _POSIX_TIMERS 0
// Note: all pthread functions are mangled to make static linking easier.
#define pthread_once m_pthread_once
#define pthread_mutex_destroy m_pthread_mutex_destroy

View File

@ -15,6 +15,7 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include <pthread.h>
#include <float.h>
#include <stdlib.h>
#include <inttypes.h>
@ -24,7 +25,6 @@
#include <assert.h>
#include <time.h>
#include <math.h>
#include <pthread.h>
#include <sys/types.h>
#include <ass/ass.h>

View File

@ -18,8 +18,8 @@
#ifndef MPLAYER_MP_CORE_H
#define MPLAYER_MP_CORE_H
#include <stdbool.h>
#include <pthread.h>
#include <stdbool.h>
#include "osdep/atomic.h"

View File

@ -15,6 +15,7 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

View File

@ -15,6 +15,8 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include <pthread.h>
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
#include <libavutil/opt.h>

View File

@ -15,6 +15,7 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include <pthread.h>
#include <archive.h>
#include <archive_entry.h>