Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

threads #29

Open
delchev opened this issue May 21, 2016 · 2 comments
Open

threads #29

delchev opened this issue May 21, 2016 · 2 comments

Comments

@delchev
Copy link
Contributor

delchev commented May 21, 2016

API for 'threads' - threads management

@delchev delchev changed the title thread threads Jun 15, 2016
@delchev
Copy link
Contributor Author

delchev commented Jun 15, 2016

Usage

/* globals $ */
/* eslint-env node, dirigible */

var threads = require('core/threads');
var response = require('net/http/response');

response.setContentType("text/plain; charset=UTF-8");

// Define a JavaScript function
function runnable() {
    response.println("Hello World from a Thread!");
};

// Pass a JavaScript function
var worker = threads.create(runnable, "I am a thread");
response.println(worker.getName());
worker.start();
worker.join(); // to be able to print to the response

response.flush();
response.close();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant