Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@awesomeeng/awesome-utils

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@awesomeeng/awesome-utils - npm Package Compare versions

Comparing version 1.4.0 to 1.4.2

4

docs/API.md

@@ -17,3 +17,3 @@ ## Classes

<dt><a href="#VMUtils">VMUtils</a></dt>
<dd><p>Utilities for working with th eunderlying virtual machine.</p>
<dd><p>Utilities for working with the underlying virtual machine.</p>
</dd>

@@ -625,3 +625,3 @@ </dl>

## VMUtils
Utilities for working with th eunderlying virtual machine.
Utilities for working with the underlying virtual machine.

@@ -628,0 +628,0 @@ **Kind**: global class

{
"name": "@awesomeeng/awesome-utils",
"version": "1.4.0",
"version": "1.4.2",
"author": "the awesome engineering company",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -23,3 +23,3 @@ # AwesomeUtils

...
await AwesumeUtils.Promise.sleep(1000); // sleeps for 1 second.
await AwesomeUtils.Promise.sleep(1000); // sleeps for 1 second.
...

@@ -26,0 +26,0 @@ ```

# AwesomeUtils Release Notes
#### **Version 1.4.1**
- AwesomeUtils.Workers: Changes lock to use -1 as the unlocked value. Adds initializeLock() function.
- AwesomeUtils.Workers: Fixes a bug in Workers.lock() and related where it would throw an exception when worker_threads not available in node.
- Documentation: Fix minor typo in documetation.
- Documentation: Merge pull request #1 from skratchdot/patch-1
- Documentation: fixing small typo in documentation.
#### **Version 1.4.0**

@@ -4,0 +16,0 @@

@@ -8,3 +8,3 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

/**
* Utilities for working with th eunderlying virtual machine.
* Utilities for working with the underlying virtual machine.
*/

@@ -11,0 +11,0 @@ class VMUtils {

@@ -5,2 +5,4 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

const UNLOCKED = -1;
let Workers = null;

@@ -23,2 +25,17 @@ try {

get threadId() {
if (Workers) return Workers.threadId;
return process.pid;
}
initializeLock(lock,index=0) {
if (!lock) throw new Error("Missing lock.");
if (!(lock instanceof Int32Array)) throw new Error("Invalid lock; must be Int32Array.");
if (index===undefined || index===null) throw new Error("Missing index.");
if (typeof index!=="number") throw new Error("Invalid index.");
if (index<0 || index>lock.length) throw new Error("Index out of range.");
lock[0] = UNLOCKED;
}
/**

@@ -38,3 +55,3 @@ * Returns true of the lock was obtained, false otherwise.

return Atomics.compareExchange(lock,index,0,Workers.threadId+1)===0;
return Atomics.compareExchange(lock,index,UNLOCKED,this.threadId)===UNLOCKED;
}

@@ -49,4 +66,4 @@

let pid = Atomics.compareExchange(lock,index,Workers.threadId+1,0);
if (pid!==Workers.threadId+1) throw new Error("Not lock owner.");
let pid = Atomics.compareExchange(lock,index,this.threadId,UNLOCKED);
if (pid!==this.threadId) throw new Error("Not lock owner.");
return true;

@@ -62,3 +79,3 @@ }

return Atomics.load(lock,index)!==0;
return Atomics.load(lock,index)!==UNLOCKED;
}

@@ -77,3 +94,3 @@

return Atomics.load(lock,index)===Workers.threadId+1;
return Atomics.load(lock,index)===this.threadId;
}

@@ -80,0 +97,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc