Giter Club home page Giter Club logo

node-windows-mutex's Introduction

windows-mutex

Build Status

Build Status

npm version

Expose the Windows CreateMutex API to Node.JS.

Installation

@vscode/windows-mutex will only compile in Windows machines, so it is advisable to use the --save-optional flag and wrap the require('@vscode/windows-mutex') call in a try {} catch {} block, in case your code also runs on other platforms.

npm install --save-optional @vscode/windows-mutex

Usage

import { Mutex } from '@vscode/windows-mutex';

var mutex = new Mutex('my-mutex');
console.log(mutex.isActive());
mutex.release();

Development

Publishing to NPM is automated via CI. As soon as a tag is pushed to the repo, that version will be built and published to NPM.

node-windows-mutex's People

Contributors

bpasero avatar deepak1556 avatar joaomoreno avatar microsoft-github-policy-service[bot] avatar rzhao271 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-windows-mutex's Issues

Can this be used for interprocess lock?

Hello I need to have a lock between multiple processes.
Is it possible to use node-windows-mutex to accomplish that?
If so, could you give me a code example?

I tried to create a new Mutex object with a specific name in 2 processes simultaneously and it seemed that the code wasn't blocked in any way.

Thanks

build vscode caught error

77203 warn optional Skipping failed optional dependency /gulp-watch/chokidar/fsevents:
77204 warn notsup Not compatible with your operating system or architecture: [email protected]
77205 verbose stack Error: [email protected] install: node-gyp rebuild
77205 verbose stack Exit status 1
77205 verbose stack at EventEmitter. (/home/luncher/.nvm/versions/node/v6.2.2/lib/node_modules/npm/lib/utils/lifecycle.js:245:16)
77205 verbose stack at emitTwo (events.js:106:13)
77205 verbose stack at EventEmitter.emit (events.js:191:7)
77205 verbose stack at ChildProcess. (/home/luncher/.nvm/versions/node/v6.2.2/lib/node_modules/npm/lib/utils/spawn.js:24:14)
77205 verbose stack at emitTwo (events.js:106:13)
77205 verbose stack at ChildProcess.emit (events.js:191:7)
77205 verbose stack at maybeClose (internal/child_process.js:852:16)
77205 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
77206 verbose pkgid [email protected]
77207 verbose cwd /home/luncher/vscode
77208 error Linux 4.1.13-100.fc21.x86_64
77209 error argv "/home/luncher/.nvm/versions/node/v6.2.2/bin/node" "/home/luncher/.nvm/versions/node/v6.2.2/bin/npm" "install" "--arch=x64"
77210 error node v6.2.2
77211 error npm v3.9.5
77212 error code ELIFECYCLE
77213 error [email protected] install: node-gyp rebuild
77213 error Exit status 1
77214 error Failed at the [email protected] install script 'node-gyp rebuild'.
77214 error Make sure you have the latest version of node.js and npm installed.
77214 error If you do, this is most likely a problem with the windows-mutex package,
77214 error not with npm itself.
77214 error Tell the author that this fails on your system:
77214 error node-gyp rebuild
77214 error You can get information on how to open an issue for this project with:
77214 error npm bugs windows-mutex
77214 error Or if that isn't available, you can get their info via:
77214 error npm owner ls windows-mutex
77214 error There is likely additional logging output above.
77215 verbose exit [ 1, true ]

platform: fedora21

Heads up: v8::Function::NewInstance': was declared deprecated

@joaomoreno Seeing this when compiling against Electron 1.3.x that comes with Chrome 52:

C:\GitDevelopment\monaco\node_modules\windows-mutex>if not defined npm_config_node_gyp (node "C:\Users\bpasero\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  main.cc
  mutex.cc
  win_delay_load_hook.cc
..\src\mutex.cc(70): warning C4996: 'v8::Function::NewInstance': was declared deprecated [C:\GitDevelopment\monaco\node_modules\windows-mutex\build\CreateMutex.vcxproj]
  C:\Users\bpasero\.node-gyp\iojs-1.3.4\deps\v8\include\v8.h(3264): note: see declaration of 'v8::Function::NewInstance'
     Creating library C:\GitDevelopment\monaco\node_modules\windows-mutex\build\Release\CreateMutex.lib and object C:\GitDevelopment\monaco\node_modules\windows-mutex\build\
  Release\CreateMutex.exp
  Generating code
  Finished generating code
  CreateMutex.vcxproj -> C:\GitDevelopment\monaco\node_modules\windows-mutex\build\Release\\CreateMutex.node
  CreateMutex.vcxproj -> C:\GitDevelopment\monaco\node_modules\windows-mutex\build\Release\CreateMutex.pdb (Full PDB)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.