Signed-off-by: Rafael Fonseca <r4f4rfs(a)gmail.com>
---
src/bhyve/bhyve_driver.c | 11 ++++-------
src/bhyve/bhyve_utils.h | 2 +-
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index b6204c7fb9..6e9a79cb52 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -73,13 +73,13 @@ bhyveConnPtr bhyve_driver = NULL;
void
bhyveDriverLock(bhyveConnPtr driver)
{
- virMutexLock(&driver->lock);
+ g_mutex_lock(&driver->lock);
}
void
bhyveDriverUnlock(bhyveConnPtr driver)
{
- virMutexUnlock(&driver->lock);
+ g_mutex_unlock(&driver->lock);
}
static int
@@ -1199,7 +1199,7 @@ bhyveStateCleanup(void)
if (bhyve_driver->lockFD != -1)
virPidFileRelease(BHYVE_STATE_DIR, "driver", bhyve_driver->lockFD);
- virMutexDestroy(&bhyve_driver->lock);
+ g_mutex_clear(&bhyve_driver->lock);
VIR_FREE(bhyve_driver);
return 0;
@@ -1228,10 +1228,7 @@ bhyveStateInitialize(bool privileged,
return VIR_DRV_STATE_INIT_ERROR;
bhyve_driver->lockFD = -1;
- if (virMutexInit(&bhyve_driver->lock) < 0) {
- VIR_FREE(bhyve_driver);
- return VIR_DRV_STATE_INIT_ERROR;
- }
+ g_mutex_init(&bhyve_driver->lock);
if (!(bhyve_driver->closeCallbacks = virCloseCallbacksNew()))
goto cleanup;
diff --git a/src/bhyve/bhyve_utils.h b/src/bhyve/bhyve_utils.h
index f3e80b6121..a92ecb48c4 100644
--- a/src/bhyve/bhyve_utils.h
+++ b/src/bhyve/bhyve_utils.h
@@ -44,7 +44,7 @@ struct _virBhyveDriverConfig {
};
struct _bhyveConn {
- virMutex lock;
+ GMutex lock;
virBhyveDriverConfigPtr config;
--
2.25.2