summaryrefslogtreecommitdiff
path: root/innobase/srv/srv0start.c
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2003-06-02 13:11:20 +0300
committerunknown <heikki@hundin.mysql.fi>2003-06-02 13:11:20 +0300
commit0ae3a4dcc134e97e48d266d4d1260d6c8c268659 (patch)
tree2c5725cba5b986c6857be7be12c3220e06d81809 /innobase/srv/srv0start.c
parent3f7dfc4df3a9bdfc01e5b84c3297fff61b791f9b (diff)
downloadmariadb-git-0ae3a4dcc134e97e48d266d4d1260d6c8c268659.tar.gz
os0thread.h, os0sync.ic, os0sync.h, os0thread.c, os0sync.c, os0file.c:
Release all event semaphores at shutdown also in Windows srv0start.c, srv0srv.c: make test sometimes failed because lock timeout thread exited without decrementing the InnoDB thread counter innobase/srv/srv0srv.c: make test sometimes failed because lock timeout thread exited without decrementing the InnoDB thread counter innobase/srv/srv0start.c: make test sometimes failed because lock timeout thread exited without decrementing the InnoDB thread counter innobase/os/os0file.c: Release all event semaphores at shutdown also in Windows innobase/os/os0sync.c: Release all event semaphores at shutdown also in Windows innobase/os/os0thread.c: Release all event semaphores at shutdown also in Windows innobase/include/os0sync.h: Release all event semaphores at shutdown also in Windows innobase/include/os0sync.ic: Release all event semaphores at shutdown also in Windows innobase/include/os0thread.h: Release all event semaphores at shutdown also in Windows
Diffstat (limited to 'innobase/srv/srv0start.c')
-rw-r--r--innobase/srv/srv0start.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c
index f03355b825c..1f278d82bc0 100644
--- a/innobase/srv/srv0start.c
+++ b/innobase/srv/srv0start.c
@@ -414,8 +414,10 @@ io_handler_thread(
segment = *((ulint*)arg);
-/* printf("Io handler thread %lu starts\n", segment); */
-
+#ifdef UNIV_DEBUG_THREAD_CREATION
+ printf("Io handler thread %lu starts\n", segment);
+ printf("Thread id %lu\n", os_thread_pf(os_thread_get_curr_id()));
+#endif
for (i = 0;; i++) {
fil_aio_wait(segment);
@@ -424,6 +426,13 @@ io_handler_thread(
mutex_exit(&ios_mutex);
}
+ /* We count the number of threads in os_thread_exit(). A created
+ thread should always use that to exit and not use return() to exit.
+ The thread actually never comes here because it is exited in an
+ os_event_wait(). */
+
+ os_thread_exit(NULL);
+
#ifndef __WIN__
return(NULL);
#else
@@ -1546,21 +1555,32 @@ innobase_shutdown_for_mysql(void)
os_thread_count);
}
- /* 3. Free all InnoDB's own mutexes */
+ /* 3. Free all InnoDB's own mutexes and the os_fast_mutexes inside
+ them */
sync_close();
- /* 4. Free all OS synchronization primitives (in Windows currently
- events are not freed) */
+ /* 4. Free the os_conc_mutex and all os_events and os_mutexes */
srv_free();
os_sync_free();
- /* 5. Free all allocated memory (and the os_fast_mutex created in
+ /* 5. Free all allocated memory and the os_fast_mutex created in
ut0mem.c */
ut_free_all_mem();
+ if (os_thread_count != 0
+ || os_event_count != 0
+ || os_mutex_count != 0
+ || os_fast_mutex_count != 0) {
+ fprintf(stderr,
+"InnoDB: Warning: some resources were not cleaned up in shutdown:\n"
+"InnoDB: threads %lu, events %lu, os_mutexes %lu, os_fast_mutexes %lu\n",
+ os_thread_count, os_event_count, os_mutex_count,
+ os_fast_mutex_count);
+ }
+
if (srv_print_verbose_log) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Shutdown completed\n");