Re: Simultaneous destructors
Jason Duell <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <bc4cf7ca-8fd1-499a-af09-6754b95b10bd@h40g2000prf.googlegroups.com> |
On Oct 8, 7:12 am, Benjamin Smedberg <[email protected]> wrote: > Is the following protocol also > race-free and allows multiple dataavailable() calls in a row? It looks like it to me. Hopefully the IPDL compiler will be able to always tell us for certain (?). > > I agree that two-phase deletion is complicated, but (i) it's the price > > to be paid for race-free deletion; (ii) two-phase deletion is a kind of > > "IPDL pattern", like "empty subprotocols", that can be documented and > > copied by other protocols. I hope so. Right now it's starting to look like a large percentage of the complexity of our protocols is likely to be in getting destruction right. There's also something gross about how much the needs of IPDL itself are getting inserted into the state protocols. It's a bit like writing TCP applications, and suddenly having to programmatically deal with incoming packets after you've already called close(). Can we really not make things more convenient? One thing that might help a little, if we do go down this road, is the ability to have IPDL discard msgs in certain states. For instance: > state CANCELED: > send dataavailable goto CANCELED; > send datadone goto CANCELED; > send oncanceled goto DONE; Right now I'd have to make sure my onDataAvailable method kept some state variable (essentially duplicating IPDL's), so that I know to simply discard a packet if I'm in the CANCELLED state. If I forget this, I might try to blindly deliver packets to to data structures I've discarded, or something like that, and there's nothing IPDL's compiler could do to help catch the mistake. So I propose something like send dataavailable goto CANCELED DISCARD; which tells IPDL that I know about the possibility of these msgs arriving in this state, but that I just want them dropped on the floor. Jason