DEV Community

Discussion on: Introducing Nexus.js: A multi-threaded JavaScript run-time

Collapse
 
voodooattack profile image
Abdullah Ali

Hi! Concurrent access to variables does not corrupt them or cause a race condition. All variables behave atomically in Nexus.

Read more here: nexusjs.com/architecture/

Collapse
 
spyke profile image
Anton Alexandrenok • Edited

So, in this particular example

When two different execution contexts that share a closure variable are entered in parallel, one will acquire a lock

means that a listener will lock on parent closure right at the start of the function till its end? Or it will lock only from the time of identifier resolution for count to finishing its value reading?

Thread Thread
 
voodooattack profile image
Abdullah Ali

It will only lock upon access to the variable and then it will release the lock as soon as it is done.

Thread Thread
 
spyke profile image
Anton Alexandrenok

Thank you.

Thread Thread
 
voodooattack profile image
Abdullah Ali

You’re welcome :)