summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-09-17 00:37:15 +0200
committerDudemanguy <random342@airmail.cc>2023-09-29 20:48:58 +0000
commitcdfd5c280a174b9e126908305c250bedbec0be61 (patch)
treedee5272dc77f4d5a60a5e2609082e06f79d5fdd1
parent318b5471a18e464cfcd1f7222da7853b7056f9fc (diff)
downloadmpv-cdfd5c280a174b9e126908305c250bedbec0be61.tar.bz2
mpv-cdfd5c280a174b9e126908305c250bedbec0be61.tar.xz
win32/pthread: define _POSIX_TIMERS to notify they are not supported
-rw-r--r--common/stats.c3
-rw-r--r--demux/demux_lavf.c1
-rw-r--r--input/input.c2
-rw-r--r--meson.build3
-rw-r--r--osdep/win32/include/pthread.h2
-rw-r--r--player/command.c2
-rw-r--r--player/core.h2
-rw-r--r--player/screenshot.c1
-rw-r--r--stream/stream_lavf.c2
-rw-r--r--stream/stream_libarchive.c1
10 files changed, 11 insertions, 8 deletions
diff --git a/common/stats.c b/common/stats.c
index 4b4093834b..ce50bdc0f3 100644
--- a/common/stats.c
+++ b/common/stats.c
@@ -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 &&
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 7ef87946bc..347763bed8 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -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>
diff --git a/input/input.c b/input/input.c
index c7bae55364..32803f653e 100644
--- a/input/input.c
+++ b/input/input.c
@@ -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"
diff --git a/meson.build b/meson.build
index 13f2b612b6..fb167790e0 100644
--- a/meson.build
+++ b/meson.build
@@ -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
diff --git a/osdep/win32/include/pthread.h b/osdep/win32/include/pthread.h
index 6c87949831..e92c471f5f 100644
--- a/osdep/win32/include/pthread.h
+++ b/osdep/win32/include/pthread.h
@@ -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
diff --git a/player/command.c b/player/command.c
index ff6df4db6a..8470e802ea 100644
--- a/player/command.c
+++ b/player/command.c
@@ -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>
diff --git a/player/core.h b/player/core.h
index b9710f61af..be06e4dc98 100644
--- a/player/core.h
+++ b/player/core.h
@@ -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"
diff --git a/player/screenshot.c b/player/screenshot.c
index 5d40d61655..37de982996 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -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>
diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c
index cfdae98137..0164ede388 100644
--- a/stream/stream_lavf.c
+++ b/stream/stream_lavf.c
@@ -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>
diff --git a/stream/stream_libarchive.c b/stream/stream_libarchive.c
index 61c95cc349..cfc1f2f96f 100644
--- a/stream/stream_libarchive.c
+++ b/stream/stream_libarchive.c
@@ -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>