I have a global variable in jquery. Two diffirent functions reading and modifying this variable in runtime.
One jquery function is reading value from this variable on every 2000 seconds and resettng it. And, a SignalR method updating this variable whenever it gets any update from server.
Is there any way to lock that variable to others while reading or writing to it?