diff options
author | unknown <anozdrin@mysql.com> | 2006-06-20 18:28:28 +0400 |
---|---|---|
committer | unknown <anozdrin@mysql.com> | 2006-06-20 18:28:28 +0400 |
commit | 46845cf357ba5d822b07e025142654673191a6c4 (patch) | |
tree | 2ec04ccb6218dd72ab8207d0d2269d1db34b35af /server-tools/instance-manager/manager.cc | |
parent | 89fc7fdb056fc8aa5ffb5da229b460e9863f0641 (diff) | |
parent | 3435f614c2951714c3c93ff7fcdc6325f7ad2e05 (diff) | |
download | mariadb-git-46845cf357ba5d822b07e025142654673191a6c4.tar.gz |
Merge mysql.com:/home/alik/MySQL/devel/5.0-to-be-merged
into mysql.com:/home/alik/MySQL/devel/5.1-merged
BitKeeper/deleted/.del-im_life_cycle-im.opt:
Delete: mysql-test/t/im_life_cycle-im.opt
BitKeeper/deleted/.del-im_utils-im.opt:
Delete: mysql-test/t/im_utils-im.opt
mysql-test/lib/mtr_process.pl:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/im_daemon_life_cycle.result:
Auto merged
mysql-test/r/im_utils.result:
Auto merged
mysql-test/r/trigger.result:
Auto merged
mysql-test/t/im_daemon_life_cycle-im.opt:
Auto merged
mysql-test/t/trigger.test:
Auto merged
server-tools/instance-manager/instance_map.cc:
Auto merged
mysql-test/r/im_life_cycle.result:
Manually merged.
mysql-test/r/insert.result:
Manually merged.
mysql-test/t/im_daemon_life_cycle.imtest:
Manually merged.
mysql-test/t/im_life_cycle.imtest:
Manually merged.
mysql-test/t/im_utils.imtest:
Manually merged.
mysql-test/t/insert.test:
Manually merged.
server-tools/instance-manager/guardian.cc:
Manually merged.
server-tools/instance-manager/manager.cc:
Manually merged.
sql/sql_insert.cc:
Manually merged.
Diffstat (limited to 'server-tools/instance-manager/manager.cc')
-rw-r--r-- | server-tools/instance-manager/manager.cc | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/server-tools/instance-manager/manager.cc b/server-tools/instance-manager/manager.cc index 599131089ed..d2d498eebf1 100644 --- a/server-tools/instance-manager/manager.cc +++ b/server-tools/instance-manager/manager.cc @@ -198,6 +198,25 @@ void manager() if (create_pid_file(Options::Main::pid_file_name, manager_pid)) return; /* necessary logging has been already done. */ + /* + Initialize signals and alarm-infrastructure. + + NOTE: To work nicely with LinuxThreads, the signal thread is the first + thread in the process. + + NOTE: + After init_thr_alarm() call it's possible to call thr_alarm() (from + different threads), that results in sending ALARM signal to the alarm + thread (which can be the main thread). That signal can interrupt + blocking calls. + + In other words, a blocking call can be interrupted in the main thread + after init_thr_alarm(). + */ + + sigset_t mask; + set_signals(&mask); + /* create guardian thread */ { pthread_t guardian_thd_id; @@ -205,9 +224,16 @@ void manager() int rc; /* - NOTE: Guardian should be shutdown first. Only then all other threads - need to be stopped. This should be done, as guardian is responsible for - shutting down the instances, and this is a long operation. + NOTE: Guardian should be shutdown first. Only then all other threads + need to be stopped. This should be done, as guardian is responsible + for shutting down the instances, and this is a long operation. + + NOTE: Guardian uses thr_alarm() when detects current state of + instances (is_running()), but it is not interfere with + flush_instances() later in the code, because until flush_instances() + complete in the main thread, Guardian thread is not permitted to + process instances. And before flush_instances() there is no instances + to proceed. */ pthread_attr_init(&guardian_thd_attr); @@ -223,10 +249,8 @@ void manager() } - /* - To work nicely with LinuxThreads, the signal thread is the first thread - in the process. - */ + /* Load instances. */ + { instance_map.guardian->lock(); @@ -246,11 +270,6 @@ void manager() } } - /* Initialize signals and alarm-infrastructure. */ - - sigset_t mask; - set_signals(&mask); - /* create the listener */ { pthread_t listener_thd_id; |