Browse Source

compat: make clock_nanosleep usable by other OSes

This is to allow clock_nanosleep to be used by emscripten
and potentially other platforms.

The file should not be compiled on windows platforms, as it won't
find sys/errno.h

mach/clock_types.h is needed for clock_id_t, and is only available on
macos.
pull/128/head
Mehdi Sabwat 5 years ago
committed by Hugo Beauzée-Luyssen
parent
commit
3f3296b03f
  1. 5
      compat/clock_nanosleep.c
  2. 3
      include/vlc_fixups.h

5
compat/clock_nanosleep.c

@ -20,7 +20,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef __APPLE__
#ifndef _WIN32
#ifdef HAVE_CONFIG_H
# include <config.h>
@ -32,7 +32,10 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/sysctl.h>
# ifdef __APPLE__
#include <mach/clock_types.h>
# endif
int clock_nanosleep(clockid_t clock_id, int flags,
const struct timespec *rqtp, struct timespec *rmtp)

3
include/vlc_fixups.h

@ -687,6 +687,9 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp);
# ifndef HAVE_CLOCK_GETRES
int clock_getres(clockid_t clock_id, struct timespec *tp);
# endif
#endif
#ifndef _WIN32
# ifndef HAVE_CLOCK_NANOSLEEP
int clock_nanosleep(clockid_t clock_id, int flags,
const struct timespec *rqtp, struct timespec *rmtp);

Loading…
Cancel
Save