Git Product home page Git Product logo

juv's Introduction

Janet libuv bindings

Bindings to the libuv library for asynchronous IO. Not yet ready for much of anything, still a working prototype. Kept in sync with the latest Janet from master, and is not guaranteed to work with anything but.

Installation

[sudo] jpm install https://github.com/janet-lang/juv.git

Building

Make sure you have cloned the libuv submodule as well. You can use git submodule update --init --recursive to do this.

jpm build

Testing

See the test directory for test scripts and programs.

jpm test

Design

juv puts a thin abstraction over libuv to be completely fiber based instead of callback based. This means all libuv calls that would normally take a callback instead take a fiber, either explicitly or by capturing the current fiber. When the asynchronous event happens and the C callback is called, the fiber is resumed with the event's payload.

To suspend a fiber until some next event, call a juv function that captures the current fiber, and then yield to the main event loop. When the event fires, the fiber will be resumed with the resulting payload (much of the file API will work like this.) Such functions must be called inside this event loop.

Using Janet's multiple signal types, we could designate a user signal, such as :user9, for all libuv related scheduling. This would make it very unlikely for juv to interfere with other uses of yield in the program not related to scheduling. For now, we use yield for convenience and easy of prototyping.

juv's People

Contributors

bakpakin avatar swlkr avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

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.