summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2002-07-23 04:24:09 +0300
committerunknown <heikki@hundin.mysql.fi>2002-07-23 04:24:09 +0300
commit4a6b039c1521f401f43ac6158e222978ac610d43 (patch)
tree293ca9ac7f09cb883be1e3aa86e037f63916e290 /innobase
parenta09aefb681982e90fc7d953e6fca633856e6c2a0 (diff)
downloadmariadb-git-4a6b039c1521f401f43ac6158e222978ac610d43.tar.gz
os0thread.c, configure.in:
Make the typecast trick pthread_t -> os_thread_id_t safer, but a full fix needs usage of appropriate Posix functions innobase/configure.in: Make the typecast trick pthread_t -> os_thread_id_t safer, but a full fix needs usage of appropriate Posix functions innobase/os/os0thread.c: Make the typecast trick pthread_t -> os_thread_id_t safer, but a full fix needs usage of appropriate Posix functions
Diffstat (limited to 'innobase')
-rw-r--r--innobase/configure.in2
-rw-r--r--innobase/os/os0thread.c15
2 files changed, 16 insertions, 1 deletions
diff --git a/innobase/configure.in b/innobase/configure.in
index b606ecfffc0..e98dc3d0f0d 100644
--- a/innobase/configure.in
+++ b/innobase/configure.in
@@ -86,7 +86,7 @@ fi
case "$target_os" in
hp*)
- CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
+ CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";;
irix*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
osf*)
diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c
index 11bff73608a..74f5fbd9494 100644
--- a/innobase/os/os0thread.c
+++ b/innobase/os/os0thread.c
@@ -32,12 +32,27 @@ os_thread_get_curr_id(void)
pthr = pthread_self();
+#ifdef UNIV_HPUX
/* TODO: in the future we have to change os_thread_id
to pthread_t; the following cast may work in a wrong way on some
systems if pthread_t is a struct; this is just a quick fix
for HP-UX to eliminate a compiler warning */
+
+ /* The below typecast trick will certainly not work if this assertion
+ fails */
+
+ ut_a(sizeof(pthread_t) >= sizeof(os_thread_id_t));
+
return(*(os_thread_id_t*)((void*) (&pthr)));
+#else
+ /* TODO: define os_thread_id_t in Unix as the same as pthread_t
+ and compare them with appropriate Posix pthread functions!
+ The following typecast will not work if pthread_t is not
+ an integer or a pointer to a unique object for the thread! */
+
+ return((os_thread_id_t)pthr);
+#endif
#endif
}