提交 2029f826 编写于 作者: J Jonathon Jongsma 提交者: Pavel Hrdina

qemu: update threading info about domain object refs

Since commit fd9ef3b3, virDomainFindByUUIDRef() no longer exists and
all virDomainObjListFindBy*() functions now increment the reference
count.
Signed-off-by: NJonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: NPavel Hrdina <phrdina@redhat.com>
上级 ec78c9a0
...@@ -25,27 +25,17 @@ There are a number of locks on various objects ...@@ -25,27 +25,17 @@ There are a number of locks on various objects
* virDomainObjPtr * virDomainObjPtr
Will be locked after calling any of the virDomainObjListFindBy{ID,Name,UUID} Will be locked and the reference counter will be increased after calling
methods. However, preferred method is qemuDomObjFromDomain() that uses any of the virDomainObjListFindBy{ID,Name,UUID} methods. The preferred way
virDomainFindByUUIDRef() which also increases the reference counter and of decrementing the reference counter and unlocking the domain is using the
finds the domain in the domain list without blocking all other lookups.
When the domain is locked and the reference increased, the preferred way of
decrementing the reference counter and unlocking the domain is using the
virDomainObjEndAPI() function. virDomainObjEndAPI() function.
Lock must be held when changing/reading any variable in the virDomainObjPtr Lock must be held when changing/reading any variable in the virDomainObjPtr
If the lock needs to be dropped & then re-acquired for a short period of
time, the reference count must be incremented first using virDomainObjRef().
There is no need to increase the reference count if qemuDomObjFromDomain()
was used for looking up the domain. In this case there is one reference
already added by that function.
This lock must not be held for anything which sleeps/waits (i.e. monitor This lock must not be held for anything which sleeps/waits (i.e. monitor
commands). commands).
* qemuMonitorPrivatePtr: Job conditions * qemuMonitorPrivatePtr: Job conditions
Since virDomainObjPtr lock must not be held during sleeps, the job Since virDomainObjPtr lock must not be held during sleeps, the job
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册