- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Wed, 31 Mar 2010 18:16:56 -0400
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? -Boris
Received on Wednesday, 31 March 2010 15:16:56 UTC