Compile dcb.c as C++

This commit is contained in:
Johan Wikman
2017-03-23 16:03:21 +02:00
parent 71ae3cf524
commit db18e19d3c
6 changed files with 17 additions and 17 deletions

View File

@ -6,7 +6,8 @@ add_library(maxscale-common SHARED
buffer.cc
config.cc
config_runtime.cc
dcb.c filter.c filter.cc externcmd.c paths.c hashtable.c hint.c housekeeper.c load_utils.c log_manager.cc maxscale_pcre2.c misc.c mlist.c modutil.c monitor.c queuemanager.c query_classifier.cc poll.c random_jkiss.c resultset.c router.cc secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c skygw_utils.cc statistics.c listener.c ssl.c mysql_utils.c mysql_binlog.c modulecmd.c)
dcb.cc
filter.c filter.cc externcmd.c paths.c hashtable.c hint.c housekeeper.c load_utils.c log_manager.cc maxscale_pcre2.c misc.c mlist.c modutil.c monitor.c queuemanager.c query_classifier.cc poll.c random_jkiss.c resultset.c router.cc secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c skygw_utils.cc statistics.c listener.c ssl.c mysql_utils.c mysql_binlog.c modulecmd.c)
if(WITH_JEMALLOC)
target_link_libraries(maxscale-common ${JEMALLOC_LIBRARIES})

View File

@ -99,7 +99,7 @@
#include "maxscale/queuemanager.h"
/* A DCB with null values, used for initialization */
static DCB dcb_initialized = DCB_INIT;
static DCB dcb_initialized;
static DCB **all_dcbs;
static SPINLOCK *all_dcbs_lock;
@ -114,12 +114,18 @@ thread_local long next_timeout_check = 0;
void dcb_global_init()
{
dcb_initialized.dcb_chk_top = CHK_NUM_DCB;
dcb_initialized.fd = DCBFD_CLOSED;
dcb_initialized.state = DCB_STATE_ALLOC;
dcb_initialized.ssl_state = SSL_HANDSHAKE_UNKNOWN;
dcb_initialized.dcb_chk_tail = CHK_NUM_DCB;
int nthreads = config_threadcount();
if ((zombies = MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL ||
(all_dcbs = MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL ||
(all_dcbs_lock = MXS_CALLOC(nthreads, sizeof(SPINLOCK))) == NULL ||
(nzombies = MXS_CALLOC(nthreads, sizeof(int))) == NULL)
if ((zombies = (DCB**)MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL ||
(all_dcbs = (DCB**)MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL ||
(all_dcbs_lock = (SPINLOCK*)MXS_CALLOC(nthreads, sizeof(SPINLOCK))) == NULL ||
(nzombies = (int*)MXS_CALLOC(nthreads, sizeof(int))) == NULL)
{
MXS_OOM();
raise(SIGABRT);

View File

@ -52,7 +52,7 @@ static SPINLOCK tasklock = SPINLOCK_INIT;
static bool do_shutdown = 0;
long hkheartbeat = 0; /*< One heartbeat is 100 milliseconds */
int64_t hkheartbeat = 0; /*< One heartbeat is 100 milliseconds */
static THREAD hk_thr_handle;
static void hkthread(void *);