summaryrefslogtreecommitdiff
path: root/include/my_pthread.h
diff options
context:
space:
mode:
authorunknown <msvensson@shellback.>2006-12-15 10:41:24 +0100
committerunknown <msvensson@shellback.>2006-12-15 10:41:24 +0100
commiteca724f45c0ec272bed53eed94616bc723391d0e (patch)
tree5d9982e3132b74ce278e5ede04f655912021f8bb /include/my_pthread.h
parent33ab28e9ad4e663f4c801064ca80648cdd6e79c9 (diff)
downloadmariadb-git-eca724f45c0ec272bed53eed94616bc723391d0e.tar.gz
Add macro for retrieving sec part of "struct timespec"
Use macros for working with "struct timespec" in event_queue.cc Fix merge problem include/my_pthread.h: Remove merge problem causing "struct timespec" to be declared twice Add macro "get_timespec_sec" used for retrieving the time in seconds sql/event_queue.cc: Use macros for working with "struct timespec" sql/log_event.cc: Add casts from "byte*" to "char*"
Diffstat (limited to 'include/my_pthread.h')
-rw-r--r--include/my_pthread.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h
index d44fd97c318..98072c304fa 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -56,11 +56,6 @@ typedef struct {
} pthread_cond_t;
-struct timespec { /* For pthread_cond_timedwait() */
- time_t tv_sec;
- long tv_nsec;
-};
-
typedef int pthread_mutexattr_t;
#define win_pthread_self my_thread_var->pthread_self
#define pthread_handler_t EXTERNC void * __cdecl
@@ -93,6 +88,7 @@ struct timespec {
GetSystemTimeAsFileTime(&((ABSTIME).start.ft)); \
(ABSTIME).timeout_msec= (long)((NSEC)/1000000); \
}
+#define get_timespec_sec(ABSTIME) ((((ABSTIME).start.i64 / 10000) + (ABSTIME).timeout_msec ) / 1000)
void win_pthread_init(void);
int win_pthread_setspecific(void *A,void *B,uint length);
@@ -414,6 +410,9 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
(ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
}
#endif /* !set_timespec_nsec */
+#ifndef get_timespec_sec
+#define get_timespec_sec(ABSTIME) (ABSTIME).ts_sec
+#endif /* !get_timespec_sec */
#else
#ifndef set_timespec
#define set_timespec(ABSTIME,SEC) \
@@ -432,6 +431,9 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
(ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
}
#endif /* !set_timespec_nsec */
+#ifndef get_timespec_sec
+#define get_timespec_sec(ABSTIME) (ABSTIME).tv_sec
+#endif /* !get_timespec_sec */
#endif /* HAVE_TIMESPEC_TS_SEC */
/* safe_mutex adds checking to mutex for easier debugging */