[PATCH 13/13] Remove refcounting from ports, sinks and sources

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/12/2013 08:37 PM, Tanu Kaskinen wrote:
> since I dislike refcounting, I decided to spend
> the effort on removing the refcounting from ports instead. That
> required removing it also from sinks and sources.
>
> Ports are now owned solely by cards, except if a sink or source
> doesn't belong to a card, in which case the sink or source owns its
> ports.

I chose refcounting for this reason: It is sometimes being owned by 
sinks/sources, and sometimes by cards. Therefore it seemed convenient to 
have refcounting instead of the above scheme; which seems more error prone.

But, how about instead having an "void* owner" pointer in the port? Then 
sink_free could just to "if (port->owner == me) port_free(port);" That 
seems slightly less error prone to me.

Even if I would say that *this* problem is more about the hashmap: It 
would be better to have a string-key-hashmap type that owned the memory 
of the key strings rather than the current scheme, which cause quite 
subtle errors, such as the one you're currently trying to correct.


-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux