summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_pthread.c34
-rw-r--r--mysys/my_static.h2
2 files changed, 18 insertions, 18 deletions
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index 2667c0670d8..d721418ffa1 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -98,25 +98,23 @@ void *my_pthread_getspecific_imp(pthread_key_t key)
#undef pthread_exit
void my_pthread_exit(void *status)
{
- NXThreadId_t tid = NXThreadGetId();
+ NXThreadId_t tid;
NXContext_t ctx;
- char name[PATH_MAX] = "";
-
- /* Do not call pthread_exit if it is not a LibC thread */
- if (tid != 0)
- {
- NXThreadGetContext(tid, &ctx);
- NXContextGetName(ctx, name, PATH_MAX);
-
- /*
- "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread"
- with a debug build of LibC the reaper can have different names
- */
- if (!strindex(name, "\'s"))
- {
- pthread_exit(status);
- }
- }
+ char name[NX_MAX_OBJECT_NAME_LEN+1] = "";
+
+ tid= NXThreadGetId();
+ if (tid == NX_INVALID_THREAD_ID || !tid)
+ return;
+ if (NXThreadGetContext(tid, &ctx) ||
+ NXContextGetName(ctx, name, sizeof(name)-1))
+ return;
+
+ /*
+ "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread"
+ with a debug build of LibC the reaper can have different names
+ */
+ if (!strindex(name, "\'s"))
+ pthread_exit(status);
}
#endif
diff --git a/mysys/my_static.h b/mysys/my_static.h
index bb408aa808d..51f9fbc922f 100644
--- a/mysys/my_static.h
+++ b/mysys/my_static.h
@@ -19,6 +19,7 @@
a shared library
*/
+C_MODE_START
#include <signal.h>
#define MAX_SIGNALS 10 /* Max signals under a dont-allow */
@@ -73,3 +74,4 @@ extern struct st_my_file_info my_file_info_default[MY_NFILE];
#if defined(THREAD) && !defined(__WIN__)
extern sigset_t my_signals; /* signals blocked by mf_brkhant */
#endif
+C_MODE_END