[openbeos-midi] Re: midi_server surviving app crash

  • From: Philippe Houdoin <philippe.houdoin@xxxxxxx>
  • To: openbeos-midi@xxxxxxxxxxxxx
  • Date: Fri, 11 Oct 2002 00:23:06 +0200 (MEST)

En réponse à Michael Pfeiffer:
> Imagine the following scenario: An application A registers a
> BMidiConsumer at the midi_server. Another app B connects
> a BMidiProducer to the consumer and starts sending 
> Midi messages to the producer. Suddenly app A crashes.

Brrr, it sounds like drama!
;-)
 
> How treats the midi_server such a situation?

Well, the IPC used by midikit2 seems to be ports, looking at some private 
members of BMidiConsummer and BMidiRoster private methods.
BeOS kernel automagicly delete ports owned by dying teams.
I guess midi_server/BMidi* classes just take care to always check 
port i/o routines for B_BAD_PORT_ID return code, and this case close any active 
connection made on this endpoint & remove all dead midi endpoint(s).

> I think it survives the app crash.

Absolutly. How neat it that :-).
 
> What happens with app B that still wants to send 
> messages to the consumer of the now not existing
> app A?

write_port[_etc]() will return B_BAD_PORT_ID.
 
> How realises the midi_server that a registered BMidiNode has
> "died" because its app has crashed?

Any SprayEvent() (private method of BMidiProducer) will fail internaly on 
write_port[_etc]().

Again, it's only *my* speculation on how the midi_server and MidiKit2 could 
works.
But, you're right, looking at how Marcus's media kit handle this scenario could 
help here...

-Philippe.

Other related posts: