On 4/15/2020 8:38 AM, Hannes Reinecke wrote:
...
I would have expected the ports to be reference counted, seeing that
they are (probably) accessed by structures with vastly different
lifetime rules.
It also would allow for a more dynamic port deletion, as you wouldn't
need to lock the entire function, only when removing it from the list.
Have you considered that?
...
See? That's what I mean.
You have event processing for that port, and additional nodes attached
to it. If all of them would be properly reference counted you could do
away with this function ...
...
As mentioned: please add locking annotations to make it clear which
functions require locking.
And I'm not sure if reference counting the ports wouldn't be a better
idea; I can't really see how you would ensure that the port is valid if
it's being used by temporary structures like FC commands.
The only _safe_ way would be to always access the ports under a lock,
but that would lead to heavy contention.
But I'll check the remaining patches.
Yes, we probably should have refcounting. Agree with your comments and
will address them.
-- james