Git Product home page Git Product logo

Comments (6)

SamDecrock avatar SamDecrock commented on August 24, 2024

I want to add that it works using this node.js module: https://github.com/EnotionZ/GpiO

But I would like to have it work with yours as yours doesn't use an interval to watch the gpio 'files' ;-)

from onoff.

fivdi avatar fivdi commented on August 24, 2024

Don't know what the problem is here. I'll take a look.

from onoff.

fivdi avatar fivdi commented on August 24, 2024

The gpiowatcher addon used by onoff to detect GPIO interrupts uses the libuv thread pool. The default size of this thread pool is 4 on unix systems. This explains why you can't watch 5 inputs. With Node v0.10.x the thread pool size can be specified using the UV_THREADPOOL_SIZE environment variable.

An example of the usage of UV_THREADPOOL_SIZE can be seen here run-five-inputs which runs five-inputs with a thread pool size of 10.

from onoff.

fivdi avatar fivdi commented on August 24, 2024

Documented the issues in README.

from onoff.

fivdi avatar fivdi commented on August 24, 2024

Using one thread to detect interrupts on a single GPIO is a bit of a waste of resources. In addition, having to increase the thread pool size using UV_THREADPOOL_SIZE in order to watch five or more inputs is more of a workaround than a solution. Better would be to detect all interrupts with one thread.

from onoff.

fivdi avatar fivdi commented on August 24, 2024

onoff v0.2.0 uses one thread to detect all interrupts. The workaround based on the UV_THREADPOOL_SIZE environment variable described above is no longer necessary.

from onoff.

Related Issues (20)

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.