- From: Kristof Zelechovski <giecrilj@stegny.2a.pl>
- Date: Mon, 11 Aug 2008 22:07:00 +0200
Guarding concurrent access to global variables is not enough if those variables hold references to objects because an object can end up in a logically inconsistent state if two threads try modifying its properties concurrently. The objects would have to be lockable to avoid corrupting global state. Even if you limit yourself to scalar variables, there is nothing to prevent a script to define a compound state as a set of scalar variables, each one with its own name. While it is not a good programming practice, old code does it a lot because it is (or was) more efficient to say 'gTransCount' than 'gTrans.count'. Chris -----Original Message----- From: whatwg-bounces@lists.whatwg.org [mailto:whatwg-bounces at lists.whatwg.org] On Behalf Of Shannon Sent: Monday, August 11, 2008 2:54 AM To: Jonas Sicking Cc: WHAT working group Subject: Re: [whatwg] WebWorkers vs. Threads Maybe I misunderstand the concept of "shared nothing" but I think denying access to global objects is unwise. Maybe in a low-level language like C that's a bad thing but high-level languages can serialise simultaneous access to variables to prevent crashes and deadlocks. Performance can be improved by explicitly declaring private thread variables using var.
Received on Monday, 11 August 2008 13:07:00 UTC