- From: Jonas Sicking <jonas@sicking.cc>
- Date: Wed, 31 Mar 2010 15:57:57 -0700
On Wed, Mar 31, 2010 at 3:16 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote: > On 3/31/10 2:38 AM, Jonas Sicking wrote: >> >> I would have expected bufferedAmount to only change as a result of an >> event being posted to the main event loop. We generally try to avoid >> "racy" variables since people don't expect them. Consider for example >> >> if (ws.bufferedAmount> ?X) { >> ? setUpSomeState(); >> } >> >> try { >> ? doOtherThings(); >> } >> finally { >> ? if (ws.bufferedAmount> ?X) { >> ? ? cleanUpState(); >> ? } >> } >> >> I'd imagine most JS developers to expect the cleanup to always happen >> if the setup did. > > Sure, but do they expect the cleanup to happen if the setup did not if > doOtherThings tried to send() stuff? > > More to the point, is send() allowed to actually send anything when called, > or does it have to buffer it all until the next time you get to the event > loop? I would expect that send() is allowed to start streaming data over the network as soon as it can, but only update bufferedAmount from the event loop. / Jonas
Received on Wednesday, 31 March 2010 15:57:57 UTC