[haiku-development] Re: BBufferGroup questions for future work

  • From: Dario Casalinuovo <b.vitruvio@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 10 Apr 2015 12:44:16 +0200

Hello Jerome, thanks for help.

I believe it's poor wording. There shouldn't be any duplicate ID in


one buffer group and this check is still missing.
SharedBufferList manages buffers in multiple teams, I think, by
searching other buffer groups with the same buffer ID. This isn't a
workaround.


Sorry for late reply, i had to sleep a bit on it to figure better what this
code is doing. I think the first thing to be changed is to have one object
per ID in the buffer list and have it memorize the needed sems of the owner
and groups that want to reclaim buffers.


The code tries to instanciate a new BufferGroup with a list of IDs to
be cloned. This isn't really a problem, if the used buffers are the
same in the same team.


The problem is that actually this make the list to have a lot of entries
for every Buffer::Id, and as said before this should be changed since it's
error proning. Also having a couple <ID, Container> we could use an HashMap
to optimize things and search for ID rather than cycling it.

A side question : is HashMap recommended? I've used TMap in bast, but it's
not a real Map/Dictionary since there are not typical optimizations. But
i've also heard discussions related to HashMap.



Yes to the first, though I don't understand how this affects the
second question.


Basically, it's searching other buffers with the same ID, if i make the
list a set (in the sense that it can't have equal items) then this can't
work. In future it will work by cycling the list of sems related to an ID.

Regards,
Dario
--
« Nullius addictus iurare in verba magistri, quo me cumque rapit tempestas,
deferor hospes. »

Other related posts: