Monitors that run on separate thread call thread_wait in stopMonitor.
Fixes problem with ordering of calls to mysql_library_end (in main) and mysql_thread_end (in monitor thr).
This commit is contained in:
@ -117,7 +117,7 @@ MYSQL_MONITOR *handle;
|
|||||||
handle->deaultPasswd = NULL;
|
handle->deaultPasswd = NULL;
|
||||||
spinlock_init(&handle->lock);
|
spinlock_init(&handle->lock);
|
||||||
}
|
}
|
||||||
thread_start(monitorMain, handle);
|
handle->tid = thread_start(monitorMain, handle);
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,6 +132,7 @@ stopMonitor(void *arg)
|
|||||||
MYSQL_MONITOR *handle = (MYSQL_MONITOR *)arg;
|
MYSQL_MONITOR *handle = (MYSQL_MONITOR *)arg;
|
||||||
|
|
||||||
handle->shutdown = 1;
|
handle->shutdown = 1;
|
||||||
|
thread_wait(handle->tid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -122,7 +122,7 @@ MYSQL_MONITOR *handle;
|
|||||||
handle->defaultPasswd = NULL;
|
handle->defaultPasswd = NULL;
|
||||||
spinlock_init(&handle->lock);
|
spinlock_init(&handle->lock);
|
||||||
}
|
}
|
||||||
thread_start(monitorMain, handle);
|
handle->tid = thread_start(monitorMain, handle);
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +137,7 @@ stopMonitor(void *arg)
|
|||||||
MYSQL_MONITOR *handle = (MYSQL_MONITOR *)arg;
|
MYSQL_MONITOR *handle = (MYSQL_MONITOR *)arg;
|
||||||
|
|
||||||
handle->shutdown = 1;
|
handle->shutdown = 1;
|
||||||
|
thread_wait(handle->tid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -49,6 +49,7 @@ typedef struct monitor_servers {
|
|||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SPINLOCK lock; /**< The monitor spinlock */
|
SPINLOCK lock; /**< The monitor spinlock */
|
||||||
|
pthread_t tid; /**< id of monitor thread */
|
||||||
int shutdown; /**< Flag to shutdown the monitor thread */
|
int shutdown; /**< Flag to shutdown the monitor thread */
|
||||||
int status; /**< Monitor status */
|
int status; /**< Monitor status */
|
||||||
char *defaultUser; /**< Default username for monitoring */
|
char *defaultUser; /**< Default username for monitoring */
|
||||||
|
|||||||
Reference in New Issue
Block a user