提交 fa8c1645 编写于 作者: N Nikolay Shirokovskiy 提交者: Daniel P. Berrange

close callback API: remove unnecessary locks

closeCallback pointer is immutable (set on connection object creation)
and self-locking.
上级 baf47a1f
......@@ -1214,10 +1214,7 @@ virConnectRegisterCloseCallback(virConnectPtr conn,
VIR_DEBUG("conn=%p", conn);
virResetLastError();
virCheckConnectReturn(conn, -1);
virObjectLock(conn);
virCheckNonNullArgGoto(cb, error);
if (virConnectCloseCallbackDataGetCallback(conn->closeCallback) != NULL) {
......@@ -1229,11 +1226,9 @@ virConnectRegisterCloseCallback(virConnectPtr conn,
virConnectCloseCallbackDataRegister(conn->closeCallback, conn, cb,
opaque, freecb);
virObjectUnlock(conn);
return 0;
error:
virObjectUnlock(conn);
virDispatchError(conn);
return -1;
}
......@@ -1259,10 +1254,7 @@ virConnectUnregisterCloseCallback(virConnectPtr conn,
VIR_DEBUG("conn=%p", conn);
virResetLastError();
virCheckConnectReturn(conn, -1);
virObjectLock(conn);
virCheckNonNullArgGoto(cb, error);
if (virConnectCloseCallbackDataGetCallback(conn->closeCallback) != cb) {
......@@ -1273,11 +1265,9 @@ virConnectUnregisterCloseCallback(virConnectPtr conn,
virConnectCloseCallbackDataUnregister(conn->closeCallback, cb);
virObjectUnlock(conn);
return 0;
error:
virObjectUnlock(conn);
virDispatchError(conn);
return -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册