summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <monty@mysql.com/narttu.mysql.fi>2006-11-30 21:56:03 +0200
committerunknown <monty@mysql.com/narttu.mysql.fi>2006-11-30 21:56:03 +0200
commit25226de9ea52d06667c2c7fbd99f5cd014764241 (patch)
tree0a9f9390874c91b9e4430fecfbbffa72967e7b69 /mysys
parent7191e775394db0392b78b07e2662c766eeace59c (diff)
downloadmariadb-git-25226de9ea52d06667c2c7fbd99f5cd014764241.tar.gz
Fixed compiler warnings
Don't assert if my_thread_end() is called twice (common case) client/mysql.cc: Removed not used variables client/mysqldump.c: Fixed compiler warnings client/mysqltest.c: Fixed compiler warnings cmd-line-utils/readline/bind.c: Fixed compiler warnings cmd-line-utils/readline/histfile.c: Fixed compiler warnings extra/replace.c: Fixed compiler warning on windows extra/yassl/taocrypt/include/algebra.hpp: Fixed compiler warnings heap/hp_write.c: Fixed compiler warnings innobase/os/os0file.c: Fixed compiler warnings libmysql/libmysql.c: Call my_end()/my_thread_end last. my_end() calls free_charsets(), which allowed me to move the call myisam/myisampack.c: Fixed compiler warnings myisammrg/myrg_rkey.c: Fixed compiler warnings mysys/my_thr_init.c: More comments Don't assert if my_thread_end() is called twice (common case) ndb/src/mgmapi/mgmapi.cpp: Fixed compiler warnings ndb/src/ndbapi/Ndb.cpp: Fixed compiler warnings ndb/src/ndbapi/NdbScanOperation.cpp: Fixed compiler warnings ndb/src/ndbapi/NdbTransaction.cpp: Fixed compiler warnings ndb/src/ndbapi/Ndblist.cpp: Fixed compiler warnings server-tools/instance-manager/guardian.cc: Removed not used variable server-tools/instance-manager/portability.h: Removed duplicated symbol sql/gen_lex_hash.cc: Fixed compiler warning sql/ha_archive.cc: Fixed compiler warnings sql/ha_ndbcluster.cc: Fixed compiler warnings sql/mysqld.cc: Fixed compiler warnings sql/sql_cache.cc: Fixed compiler warnings Fixed DBUG_PRINT strings to be consistent with 5.1 sql/tztime.cc: Fixed compiler warnings sql/uniques.cc: Fixed compiler warnings
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_thr_init.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index 0e921bbe8a0..fcae18d4686 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -98,7 +98,7 @@ my_bool my_thread_global_init(void)
pthread_mutex_init(&THR_LOCK_net,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&THR_LOCK_charset,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&THR_LOCK_threads,MY_MUTEX_INIT_FAST);
- pthread_cond_init (&THR_COND_threads, NULL);
+ pthread_cond_init(&THR_COND_threads, NULL);
#if defined( __WIN__) || defined(OS2)
win_pthread_init();
#endif
@@ -131,7 +131,8 @@ void my_thread_global_end(void)
if (error == ETIMEDOUT || error == ETIME)
{
if (THR_thread_count)
- fprintf(stderr,"Error in my_thread_global_end(): %d threads didn't exit\n",
+ fprintf(stderr,
+ "Error in my_thread_global_end(): %d threads didn't exit\n",
THR_thread_count);
all_threads_killed= 0;
break;
@@ -170,10 +171,23 @@ void my_thread_global_end(void)
static long thread_id=0;
/*
- We can't use mutex_locks here if we are using windows as
- we may have compiled the program with SAFE_MUTEX, in which
- case the checking of mutex_locks will not work until
- the pthread_self thread specific variable is initialized.
+ Allocate thread specific memory for the thread, used by mysys and dbug
+
+ SYNOPSIS
+ my_thread_init()
+
+ NOTES
+ We can't use mutex_locks here if we are using windows as
+ we may have compiled the program with SAFE_MUTEX, in which
+ case the checking of mutex_locks will not work until
+ the pthread_self thread specific variable is initialized.
+
+ This function may called multiple times for a thread, for example
+ if one uses my_init() followed by mysql_server_init().
+
+ RETURN
+ 0 ok
+ 1 Fatal error; mysys/dbug functions can't be used
*/
my_bool my_thread_init(void)
@@ -225,11 +239,22 @@ end:
}
+/*
+ Deallocate memory used by the thread for book-keeping
+
+ SYNOPSIS
+ my_thread_end()
+
+ NOTE
+ This may be called multiple times for a thread.
+ This happens for example when one calls 'mysql_server_init()'
+ mysql_server_end() and then ends with a mysql_end().
+*/
+
void my_thread_end(void)
{
struct st_my_thread_var *tmp;
tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
- DBUG_ASSERT(tmp);
#ifdef EXTRA_DEBUG_THREADS
fprintf(stderr,"my_thread_end(): tmp: 0x%lx thread_id=%ld\n",
@@ -272,7 +297,6 @@ void my_thread_end(void)
#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)
pthread_setspecific(THR_KEY_mysys,0);
#endif
-
}
struct st_my_thread_var *_my_thread_var(void)