Merge branch 'master' of https://github.com/86Box/86Box
This commit is contained in:
@@ -104,7 +104,7 @@ if(MSVC_TOOLSET_VERSION GREATER_EQUAL 142 AND ARCH STREQUAL "arm64")
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# HACK: MinGW does not have `timespec_get`
|
# HACK: MinGW and macOS <10.15 does not have `timespec_get`
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
check_symbol_exists(timespec_get time.h HAS_TIMESPEC_GET)
|
check_symbol_exists(timespec_get time.h HAS_TIMESPEC_GET)
|
||||||
if(HAS_TIMESPEC_GET)
|
if(HAS_TIMESPEC_GET)
|
||||||
|
@@ -6,10 +6,6 @@
|
|||||||
#include <86box/86box.h>
|
#include <86box/86box.h>
|
||||||
#include <86box/plat.h>
|
#include <86box/plat.h>
|
||||||
|
|
||||||
#ifndef HAS_TIMESPEC_GET
|
|
||||||
# define timespec_get(ts, _) clock_gettime(CLOCK_REALTIME, ts)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct event_pthread_t
|
typedef struct event_pthread_t
|
||||||
{
|
{
|
||||||
@@ -105,7 +101,11 @@ thread_wait_event(event_t *handle, int timeout)
|
|||||||
event_pthread_t *event = (event_pthread_t *)handle;
|
event_pthread_t *event = (event_pthread_t *)handle;
|
||||||
struct timespec abstime;
|
struct timespec abstime;
|
||||||
|
|
||||||
|
#ifdef HAS_TIMESPEC_GET
|
||||||
timespec_get(&abstime, TIME_UTC);
|
timespec_get(&abstime, TIME_UTC);
|
||||||
|
#else
|
||||||
|
clock_gettime(CLOCK_REALTIME, &abstime);
|
||||||
|
#endif
|
||||||
abstime.tv_nsec += (timeout % 1000) * 1000000;
|
abstime.tv_nsec += (timeout % 1000) * 1000000;
|
||||||
abstime.tv_sec += (timeout / 1000);
|
abstime.tv_sec += (timeout / 1000);
|
||||||
if (abstime.tv_nsec > 1000000000) {
|
if (abstime.tv_nsec > 1000000000) {
|
||||||
|
Reference in New Issue
Block a user