diff options
author | unknown <anozdrin/alik@booka.> | 2006-11-21 17:31:03 +0300 |
---|---|---|
committer | unknown <anozdrin/alik@booka.> | 2006-11-21 17:31:03 +0300 |
commit | cbfff7304d60f56853bb1312dbe6fe42ebbeffee (patch) | |
tree | 6c79fe045d0eb04480800567a480ab43b9ad1d4f /server-tools/instance-manager/thread_registry.h | |
parent | 817c6a4f1a92ff2f38da695bf70e9ede0bd4d0a0 (diff) | |
download | mariadb-git-cbfff7304d60f56853bb1312dbe6fe42ebbeffee.tar.gz |
Polishing:
1) add support for joinable threads to Thread class;
2) move checking of thread model to Manager from mysqlmanager.cc,
because it is needed only for IM-main process.
server-tools/instance-manager/instance.cc:
Use Manager::is_linux_threads() instead of global variable.
server-tools/instance-manager/listener.cc:
Use Thread::start(DETACHED) instead of Thread::start_detached().
server-tools/instance-manager/manager.cc:
1. Use Thread::start(DETACHED) instead of Thread::start_detached();
2. Move checking of thread model to Manager from mysqlmanager.cc,
because it is needed only for IM-main process.
server-tools/instance-manager/manager.h:
Move checking of thread model to Manager from mysqlmanager.cc,
because it is needed only for IM-main process.
server-tools/instance-manager/mysqlmanager.cc:
Move checking of thread model to Manager from mysqlmanager.cc,
because it is needed only for IM-main process.
server-tools/instance-manager/priv.cc:
Move checking of thread model to Manager from mysqlmanager.cc,
because it is needed only for IM-main process.
server-tools/instance-manager/priv.h:
Move checking of thread model to Manager from mysqlmanager.cc,
because it is needed only for IM-main process.
server-tools/instance-manager/thread_registry.cc:
Add support of joinable threads to Thread class.
server-tools/instance-manager/thread_registry.h:
Add support of joinable threads to Thread class.
Diffstat (limited to 'server-tools/instance-manager/thread_registry.h')
-rw-r--r-- | server-tools/instance-manager/thread_registry.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/server-tools/instance-manager/thread_registry.h b/server-tools/instance-manager/thread_registry.h index 034ac1b0ca8..b9ece271c21 100644 --- a/server-tools/instance-manager/thread_registry.h +++ b/server-tools/instance-manager/thread_registry.h @@ -86,17 +86,42 @@ private: class Thread { public: - Thread() {} - bool start_detached(); + enum enum_thread_type + { + DETACHED, + JOINABLE + }; +public: + Thread() + { } + +public: + inline bool is_detached() const; + + bool start(enum_thread_type thread_type = JOINABLE); + bool join(); + protected: virtual void run()= 0; virtual ~Thread(); + +private: + pthread_t id; + bool detached; + private: static void *thread_func(void *arg); + +private: Thread(const Thread & /* rhs */); /* not implemented */ Thread &operator=(const Thread & /* rhs */); /* not implemented */ }; +inline bool Thread::is_detached() const +{ + return detached; +} + /** Thread_registry - contains handles for each worker thread to deliver |