[haiku-commits] Re: haiku: hrev50043 - src/servers/media_addon

  • From: Dario Casalinuovo <b.vitruvio@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 21 Jan 2016 13:44:21 +0100


The reason is that the lifecycle of the thread is exactly determined by
the port close. When this happens the port will stop to accept writes and
will finish to handle the eventual messages in the queue. Once the queue is
empty the next read return B_BAD_PORT_ID. This will usually happen in the
node destructor, which will wait for the thread and delete the port
definitely.

I know, I wrote this code. All commits made by "beveloper" were written by
me, including all the media kit code committed by ejakowatz in hrev10.


Yeah I know too of course. I've just a few months ago said thank you for
developing all this stuff :-)



Other than that this avoid to do two checks, the change makes more
esplicit when the object is supposed to die, since we will never get
B_TIMED_OUT or B_WOULD_BLOCK I see more logical to check against
B_BAD_PORT_ID for both efficiency and code explicitness.

I disagree, previously the code explicitly allowed B_ERROR in addition to
B_OK results, all other errors exit the loop.

I think this micro optimization isn't useful. I really don't know why you
are wasting you time with something like this.


The media_kit should be massaged, I'm from time to time reading the code
you wrote, when I see something that I think should be fixed I just do it.
I have other work locally, and I try to get mainstream things that I can
easily extract from my local changes.


The loop rarely executes this comparision. But now  you easily run into an
endless loop, but it's only priority 12 so I don't care.


I understand your reasons. And I've no problems on reverting as you all
suggested. Just as a side note, this is another example for why I've been
proposing to drop ports in a future media_kit version. Here the only thing
the thread should do is to activate at a certain time, but with ports it
looks like the complexity doesn't fits the needs.

Other related posts: