summaryrefslogtreecommitdiff
path: root/mysys/my_pthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'mysys/my_pthread.c')
-rw-r--r--mysys/my_pthread.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index 2667c0670d8..37517fb8327 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -23,7 +23,6 @@
#include <signal.h>
#include <m_string.h>
#include <thr_alarm.h>
-#include <assert.h>
#if (defined(__BSD__) || defined(_BSDI_VERSION)) && !defined(HAVE_mit_thread)
#define SCHED_POLICY SCHED_RR
@@ -98,25 +97,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