Atomics.isLockFree() function in JavaScript


The Atomic object of JavaScript is an object and which provides atomic operations such as add, sub, and, or, xor, load, store etc. as static methods, these methods are used with SharedArrayBuffer objects.

This method is used to determine whether to use locks or atomic operations.

Syntax

Its syntax is as follows

Atomics.isLockFree(size)

Example

 Live Demo

<html>
<head>
   <title>JavaScript Example</title>
</head>
<body>
   <script>
      document.write(Atomics.isLockFree(7));
      document.write("<br>");
      document.write(" "+Atomics.isLockFree(8));
   </script>
</body>
</html>

Output

false
false

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 25-Jun-2020

67 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements