From 73438ad1de4e2c9fef700c6b2ab2d8626cc7b9ce Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Thu, 21 Sep 2023 12:03:08 -0500 Subject: [PATCH] test --- meson.build | 10 ++--- osdep/win32/include/semaphore.h | 44 ------------------- osdep/win32/{pthread.c => pthread_wrapper.c} | 3 -- .../{include/pthread.h => pthread_wrapper.h} | 22 ++++++++++ 4 files changed, 26 insertions(+), 53 deletions(-) delete mode 100644 osdep/win32/include/semaphore.h rename osdep/win32/{pthread.c => pthread_wrapper.c} (99%) rename osdep/win32/{include/pthread.h => pthread_wrapper.h} (86%) diff --git a/meson.build b/meson.build index 29a93e5757ed6..7f9fb4c80c831 100644 --- a/meson.build +++ b/meson.build @@ -351,7 +351,6 @@ endif # This currently works because these are the last flags set # in the build for windows. Adding any new flags after this # will probably break something. -includedir = [] win32_pthreads = get_option('win32-internal-pthreads').require( win32 and not posix, error_message: 'the os is not win32!', @@ -362,8 +361,7 @@ if features['win32-internal-pthreads'] # Note: Adding this include causes POSIX_TIMERS to be defined for # unclear reasons (some confusion with probably). # Hack around it by using HAVE_WIN32_INTERNAL_PTHREADS. - includedir += include_directories('osdep/win32/include') - sources += files('osdep/win32/pthread.c') + sources += files('osdep/win32/pthread_wrapper.c') endif pthread_debug = get_option('pthread-debug').require( @@ -1724,8 +1722,8 @@ client_api_version = major + '.' + minor + '.0' libmpv = library('mpv', sources, dependencies: dependencies, gnu_symbol_visibility: 'hidden', link_args: cc.get_supported_link_arguments(['-Wl,-Bsymbolic']), - version: client_api_version, include_directories: includedir, - install: get_option('libmpv'), build_by_default: get_option('libmpv')) + version: client_api_version, install: get_option('libmpv'), + build_by_default: get_option('libmpv')) if get_option('libmpv') @@ -1767,7 +1765,7 @@ if get_option('cplayer') install_data('etc/mpv-symbolic.svg', install_dir: join_paths(hicolor_dir, 'symbolic', 'apps')) mpv = executable('mpv', objects: libmpv.extract_all_objects(recursive: true), dependencies: dependencies, - win_subsystem: 'windows,6.0', include_directories: includedir, install: true) + win_subsystem: 'windows,6.0', install: true) endif if get_option('tests') diff --git a/osdep/win32/include/semaphore.h b/osdep/win32/include/semaphore.h deleted file mode 100644 index bc0ed2e374913..0000000000000 --- a/osdep/win32/include/semaphore.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2017 the mpv developers - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef MP_WRAP_SEMAPHORE_H_ -#define MP_WRAP_SEMAPHORE_H_ - -#include - -// See pthread.h for rationale. -#define sem_init m_sem_init -#define sem_destroy m_sem_destroy -#define sem_wait m_sem_wait -#define sem_trywait m_sem_trywait -#define sem_timedwait m_sem_timedwait -#define sem_post m_sem_post - -#define SEM_VALUE_MAX 100 - -typedef struct { - pthread_mutex_t lock; - pthread_cond_t wakeup; - unsigned int value; -} sem_t; - -int sem_init(sem_t *sem, int pshared, unsigned int value); -int sem_destroy(sem_t *sem); -int sem_wait(sem_t *sem); -int sem_trywait(sem_t *sem); -int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout); -int sem_post(sem_t *sem); - -#endif diff --git a/osdep/win32/pthread.c b/osdep/win32/pthread_wrapper.c similarity index 99% rename from osdep/win32/pthread.c rename to osdep/win32/pthread_wrapper.c index a178d72253e6d..77269816ff8a6 100644 --- a/osdep/win32/pthread.c +++ b/osdep/win32/pthread_wrapper.c @@ -13,9 +13,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include -#include - #include #include #include diff --git a/osdep/win32/include/pthread.h b/osdep/win32/pthread_wrapper.h similarity index 86% rename from osdep/win32/include/pthread.h rename to osdep/win32/pthread_wrapper.h index 6c87949831880..24e366887d529 100644 --- a/osdep/win32/include/pthread.h +++ b/osdep/win32/pthread_wrapper.h @@ -96,4 +96,26 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void pthread_set_name_np(pthread_t thread, const char *name); +#define sem_init m_sem_init +#define sem_destroy m_sem_destroy +#define sem_wait m_sem_wait +#define sem_trywait m_sem_trywait +#define sem_timedwait m_sem_timedwait +#define sem_post m_sem_post + +#define SEM_VALUE_MAX 100 + +typedef struct { + pthread_mutex_t lock; + pthread_cond_t wakeup; + unsigned int value; +} sem_t; + +int sem_init(sem_t *sem, int pshared, unsigned int value); +int sem_destroy(sem_t *sem); +int sem_wait(sem_t *sem); +int sem_trywait(sem_t *sem); +int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout); +int sem_post(sem_t *sem); + #endif