On Tue, Oct 11, 2016 at 03:44:45PM -0400, Dawid Zamirski wrote:
On Tue, 2016-10-11 at 10:58 -0400, Dawid Zamirski wrote:On Tue, 2016-10-11 at 16:22 +0200, Martin Kletzander wrote: > On Wed, Sep 28, 2016 at 01:41:35PM -0400, Dawid Zamirski wrote: > > I don't understand how vbox works, but if initializing > g_pVBoxGlobalData > does not make any connection, and ISession does (which would make > sense), we could keep the global data around and add ISession for > each connection. I guess that's something you're talking about > below. Neither I'm super familiar with vbox internals, but your suggestion sounds reasonable, so I'll dive into that code in vbox source to find out.So after a quick glance at vbox initalization code, it seems that both IVirtualBox and ISession are reference counted global instances (g_VirtualBox and g_Session [1]) and both are allocated and released in pfnComInitialize [2] and pfnComUninitialize [3] implementation calls. As such I won't be able to separate out ISession instances to be per- connection while keeping global IVirtualBox reference.
I don't see any reference counting from their side. Anyway, it looks like we cannot separate them, but we can get rid of them when we stop supporting the old version that has only the legacy initialization support. It's super-weird that they have global variable AND they still need to get that passed. It's like a combination of wrong and non-reentrant design. Anyway, they call it legacy, so I guess we should move to the new one if possible. But I think you already mentioned that, I'm just not sure.
[1] https://github.com/mdaniel/virtualbox-org-svn-vbox-trunk/blob/maste r/src/VBox/Main/cbinding/VBoxCAPI.cpp#L46-L49 [2] https://github.com/mdaniel/virtualbox-org-svn-vbox-trunk/blob/maste r/src/VBox/Main/cbinding/VBoxCAPI.cpp#L480-L481 [3] https://github.com/mdaniel/virtualbox-org-svn-vbox-trunk/blob/maste r/src/VBox/Main/cbinding/VBoxCAPI.cpp#L493-L502
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list