1
1

Add check for timersub to opal_lifo and opal_fifo tests

Some platforms do not provide a timersub macro. This commit adds a definition
to both tests when running on one of these platforms.
Этот коммит содержится в:
Nathan Hjelm 2014-12-17 22:16:15 -07:00
родитель 4d55ae838d
Коммит bc33b7a71d
2 изменённых файлов: 24 добавлений и 0 удалений

Просмотреть файл

@ -28,6 +28,18 @@
#define ITEM_COUNT 100
#define ITEMS_PER_LOOP 30
#if !defined(timersub)
#define timersub(a, b, r) \
do { \
(r)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
if ((a)->tv_usec < (b)->tv_usec) { \
(r)->tv_sec--; \
(a)->tv_usec += 1000000; \
} \
(r)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
} while (0)
#endif
static void *thread_test (void *arg) {
opal_fifo_t *fifo = (opal_fifo_t *) arg;
opal_list_item_t *item;

Просмотреть файл

@ -27,6 +27,18 @@
#define ITERATIONS 1000000
#define ITEM_COUNT 100
#if !defined(timersub)
#define timersub(a, b, r) \
do { \
(r)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
if ((a)->tv_usec < (b)->tv_usec) { \
(r)->tv_sec--; \
(a)->tv_usec += 1000000; \
} \
(r)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
} while (0)
#endif
static void *thread_test (void *arg) {
opal_lifo_t *lifo = (opal_lifo_t *) arg;
opal_list_item_t *item;