diff options
Diffstat (limited to 'dbug/dbug.c')
-rw-r--r-- | dbug/dbug.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c index 7f4292d18b1..4ddf785b27c 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -71,7 +71,12 @@ * */ +/* + We can't have SAFE_MUTEX defined here as this will cause recursion + in pthread_mutex_lock +*/ +#undef SAFE_MUTEX #include <my_global.h> #include <m_string.h> #include <errno.h> @@ -79,7 +84,6 @@ #include <process.h> #endif - #ifndef DBUG_OFF @@ -322,12 +326,11 @@ static unsigned long Clock(void); #ifdef THREAD #include <my_pthread.h> -pthread_mutex_t THR_LOCK_dbug; +static pthread_mutex_t THR_LOCK_dbug; static CODE_STATE *code_state(void) { - CODE_STATE *cs=0; - struct st_my_thread_var *tmp; + CODE_STATE *cs, **cs_ptr; if (!init_done) { @@ -338,18 +341,17 @@ static CODE_STATE *code_state(void) init_done=TRUE; } - if ((tmp=my_thread_var)) + if (!(cs_ptr= (CODE_STATE**) my_thread_var_dbug())) + return 0; /* Thread not initialised */ + if (!(cs= *cs_ptr)) { - if (!(cs=(CODE_STATE *) tmp->dbug)) - { - cs=(CODE_STATE*) DbugMalloc(sizeof(*cs)); - bzero((uchar*) cs,sizeof(*cs)); - cs->process= db_process ? db_process : "dbug"; - cs->func="?func"; - cs->file="?file"; - cs->stack=&init_settings; - tmp->dbug= (void*) cs; - } + cs=(CODE_STATE*) DbugMalloc(sizeof(*cs)); + bzero((uchar*) cs,sizeof(*cs)); + cs->process= db_process ? db_process : "dbug"; + cs->func="?func"; + cs->file="?file"; + cs->stack=&init_settings; + *cs_ptr= cs; } return cs; } |