repositories
/
deb_libcec.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
separate mutex for CUSBCECAdapterCommunication::MarkAsWaiting()
[deb_libcec.git]
/
src
/
lib
/
platform
/
posix
/
os-threads.h
diff --git
a/src/lib/platform/posix/os-threads.h
b/src/lib/platform/posix/os-threads.h
index c37beed2bef14f5a0e998c30c953d43968210e2e..7b7fc3c118273812ee99001f99b46f2acfe26baf 100644
(file)
--- a/
src/lib/platform/posix/os-threads.h
+++ b/
src/lib/platform/posix/os-threads.h
@@
-2,7
+2,7
@@
/*
* This file is part of the libCEC(R) library.
*
/*
* This file is part of the libCEC(R) library.
*
- * libCEC(R) is Copyright (C) 2011-201
2
Pulse-Eight Limited. All rights reserved.
+ * libCEC(R) is Copyright (C) 2011-201
3
Pulse-Eight Limited. All rights reserved.
* libCEC(R) is an original work, containing original code.
*
* libCEC(R) is a trademark of Pulse-Eight Limited.
* libCEC(R) is an original work, containing original code.
*
* libCEC(R) is a trademark of Pulse-Eight Limited.
@@
-49,7
+49,14
@@
namespace PLATFORM
inline struct timespec GetAbsTime(uint64_t iIncreaseBy = 0)
{
struct timespec now;
inline struct timespec GetAbsTime(uint64_t iIncreaseBy = 0)
{
struct timespec now;
+ #ifdef __APPLE__
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ now.tv_sec = tv.tv_sec;
+ now.tv_nsec = tv.tv_usec * 1000;
+ #else
clock_gettime(CLOCK_REALTIME, &now);
clock_gettime(CLOCK_REALTIME, &now);
+ #endif
now.tv_nsec += iIncreaseBy % 1000 * 1000000;
now.tv_sec += iIncreaseBy / 1000 + now.tv_nsec / 1000000000;
now.tv_nsec %= 1000000000;
now.tv_nsec += iIncreaseBy % 1000 * 1000000;
now.tv_sec += iIncreaseBy / 1000 + now.tv_nsec / 1000000000;
now.tv_nsec %= 1000000000;
@@
-57,9
+64,10
@@
namespace PLATFORM
}
typedef pthread_t thread_t;
}
typedef pthread_t thread_t;
+ #define INVALID_THREAD_VALUE 0
#define ThreadsCreate(thread, func, arg) (pthread_create(&thread, NULL, (void *(*) (void *))func, (void *)arg) == 0)
#define ThreadsCreate(thread, func, arg) (pthread_create(&thread, NULL, (void *(*) (void *))func, (void *)arg) == 0)
- #define ThreadsWait(thread, retval) (
pthread_join(thread, retval) == 0
)
+ #define ThreadsWait(thread, retval) (
thread ? pthread_join(thread, retval) == 0 : true
)
typedef pthread_mutex_t mutex_t;
#define MutexCreate(mutex) pthread_mutex_init(&mutex, GetRecursiveMutexAttribute());
typedef pthread_mutex_t mutex_t;
#define MutexCreate(mutex) pthread_mutex_init(&mutex, GetRecursiveMutexAttribute());