diff options
author | unknown <anozdrin/alik@alik.> | 2006-10-24 18:23:16 +0400 |
---|---|---|
committer | unknown <anozdrin/alik@alik.> | 2006-10-24 18:23:16 +0400 |
commit | aeec459369c951b66a65fa2238dd0e4185ab2aa3 (patch) | |
tree | 6d8630918dcef38a122bcfb66ecee31e94a8b0af /server-tools/instance-manager/thread_registry.h | |
parent | 66b872805cbd542c6012eef7141443d95a697f7d (diff) | |
download | mariadb-git-aeec459369c951b66a65fa2238dd0e4185ab2aa3.tar.gz |
Fix for BUG#17486: IM: race condition on exit.
The problem was that IM stoped guarded instances on shutdown,
but didn't wait for them to stop.
The fix is to wait for guarded instances to stop before exitting
from the main thread.
The idea is that Instance-monitoring thread should add itself
to Thread_registry so that it will be taken into account on shutdown.
However, Thread_registry should not signal it on shutdown in order to
not interrupt wait()/waitpid().
server-tools/instance-manager/guardian.cc:
Be more verbose.
server-tools/instance-manager/instance.cc:
Register mysqld-monitoring thread in Thread_registry.
server-tools/instance-manager/instance.h:
Add reference to Thread_registry.
server-tools/instance-manager/instance_map.cc:
Pass Thread_registry reference to Instance.
server-tools/instance-manager/instance_map.h:
Add reference to Thread_registry.
server-tools/instance-manager/listener.cc:
Be more verbose.
server-tools/instance-manager/manager.cc:
Be more verbose.
server-tools/instance-manager/mysql_connection.cc:
Eliminate type-conversion warnings.
server-tools/instance-manager/thread_registry.cc:
Be more verbose.
server-tools/instance-manager/thread_registry.h:
Eliminate copy&paste, make impl-specific constructor private.
Diffstat (limited to 'server-tools/instance-manager/thread_registry.h')
-rw-r--r-- | server-tools/instance-manager/thread_registry.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/server-tools/instance-manager/thread_registry.h b/server-tools/instance-manager/thread_registry.h index 6dc320a8533..503d24e5fb0 100644 --- a/server-tools/instance-manager/thread_registry.h +++ b/server-tools/instance-manager/thread_registry.h @@ -67,13 +67,17 @@ class Thread_info { public: - Thread_info(); - Thread_info(pthread_t thread_id_arg); + Thread_info(pthread_t thread_id_arg, bool send_signal_on_shutdown_arg); friend class Thread_registry; + +private: + Thread_info(); + private: pthread_cond_t *current_cond; Thread_info *prev, *next; pthread_t thread_id; + bool send_signal_on_shutdown; }; @@ -98,6 +102,10 @@ public: int cond_timedwait(Thread_info *info, pthread_cond_t *cond, pthread_mutex_t *mutex, struct timespec *wait_time); private: + void interrupt_threads(); + void wait_for_threads_to_unregister(); + +private: Thread_info head; bool shutdown_in_progress; pthread_mutex_t LOCK_thread_registry; |