summaryrefslogtreecommitdiff
path: root/sql/wsrep_thd.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-12-26 09:40:49 +0100
committerSergei Golubchik <serg@mariadb.org>2016-01-25 16:38:24 +0100
commit744e605de05354bdb18f9241daa8331687492f6b (patch)
tree7ceb5e9684e0e991f2cdab69ccf0fb02c75c8ebd /sql/wsrep_thd.cc
parent0fab28ceddb61ce9caf15f6449d3d500577e3892 (diff)
downloadmariadb-git-744e605de05354bdb18f9241daa8331687492f6b.tar.gz
cleanup: wsrep helper to create a thread
Diffstat (limited to 'sql/wsrep_thd.cc')
-rw-r--r--sql/wsrep_thd.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index ab09a9e3a99..cb9822d1599 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -369,6 +369,14 @@ static void wsrep_replication_process(THD *thd)
DBUG_VOID_RETURN;
}
+static bool create_wsrep_THD(wsrep_thd_processor_fun processor)
+{
+ pthread_t unused;
+ bool res= pthread_create(&unused, &connection_attrib, start_wsrep_THD,
+ (void*)processor);
+ return res;
+}
+
void wsrep_create_appliers(long threads)
{
if (!wsrep_connected)
@@ -385,11 +393,8 @@ void wsrep_create_appliers(long threads)
}
long wsrep_threads=0;
- pthread_t hThread;
while (wsrep_threads++ < threads) {
- if (pthread_create(
- &hThread, &connection_attrib,
- start_wsrep_THD, (void*)wsrep_replication_process))
+ if (create_wsrep_THD(wsrep_replication_process))
WSREP_WARN("Can't create thread to manage wsrep replication");
}
}
@@ -476,10 +481,8 @@ void wsrep_create_rollbacker()
{
if (wsrep_provider && strcasecmp(wsrep_provider, "none"))
{
- pthread_t hThread;
/* create rollbacker */
- if (pthread_create( &hThread, &connection_attrib,
- start_wsrep_THD, (void*)wsrep_rollback_process))
+ if (create_wsrep_THD(wsrep_rollback_process))
WSREP_WARN("Can't create thread to manage wsrep rollback");
}
}