mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -71,7 +71,6 @@ static void daemonize(const char *log_file_name);
|
||||
static void angel();
|
||||
static struct passwd *check_user(const char *user);
|
||||
static int set_user(const char *user, struct passwd *user_info);
|
||||
static bool check_if_linuxthreads();
|
||||
#endif
|
||||
|
||||
|
||||
@ -111,9 +110,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (check_if_linuxthreads())
|
||||
goto main_end; /* out of resources */
|
||||
|
||||
if (Options::Daemon::run_as_service)
|
||||
{
|
||||
/* forks, and returns only in child */
|
||||
@ -395,28 +391,4 @@ spawn:
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
static void *check_if_linuxthreads_thread_func(void *arg)
|
||||
{
|
||||
pid_t main_pid= *(pid_t*) arg;
|
||||
linuxthreads= getpid() != main_pid;
|
||||
return NULL;
|
||||
}
|
||||
} /* extern "C" */
|
||||
|
||||
|
||||
static bool check_if_linuxthreads()
|
||||
{
|
||||
pid_t pid= getpid();
|
||||
pthread_t thread_id;
|
||||
int rc;
|
||||
|
||||
rc= pthread_create(&thread_id, NULL, check_if_linuxthreads_thread_func,
|
||||
(void*) &pid);
|
||||
if (rc == 0)
|
||||
rc= pthread_join(thread_id, NULL);
|
||||
|
||||
return test(rc);
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user