Skip to content

Commit

Permalink
#2 update known issues and known limitations links
Browse files Browse the repository at this point in the history
  • Loading branch information
wilk committed Nov 4, 2018
1 parent c7325fa commit 61788b6
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Microjob

[![npm version](https://badge.fury.io/js/microjob.svg)](https://badge.fury.io/js/microjob)
[![Build Status](https://travis-ci.org/wilk/microjob.svg?branch=master)](https://travis-ci.org/wilk/microjob)
[![Coverage Status](https://coveralls.io/repos/github/wilk/microjob/badge.svg?branch=feature%2Fcoverage)](https://coveralls.io/github/wilk/microjob?branch=feature%2Fcoverage)
Expand All @@ -11,6 +12,7 @@ A tiny wrapper for turning [Node.js threads](https://nodejs.org/api/worker_threa
[When my multithreaded program works like a charm - thecodinglove](https://thecodinglove.com/when-my-multithreaded-program-works-like-a-charm)

## Introduction

Microjob is a tiny wrapper for Node.js threads and is intended to perform heavy CPU loads using anonymous functions.
So, Microjob treats Node.js threads as temporary working units: if you need to spawn a long-living thread, then you should use the [default API](https://nodejs.org/api/worker_threads.html).

Expand All @@ -24,46 +26,51 @@ Quoting the documentation:
More details explained in: **[Microjob: a tiny multithreading library for Node.js](https://hackernoon.com/microjob-a-tiny-multithreading-library-for-node-js-92d0500b07d5)**

## Installation

Via **npm**:

```bash
$ npm install --save microjob
```

## Quick Example

```js
(async () => {
const { job, start, stop } = require('microjob')
const { job, start, stop } = require("microjob");

try {
// start the worker pool
await start()
await start();

// this function will be executed in another thread
const res = await job(() => {
let i = 0
let i = 0;
for (i = 0; i < 1000000; i++) {
// heavy CPU load ...
}

return i
})
return i;
});

console.log(res) // 1000000
console.log(res); // 1000000
} catch (err) {
console.error(err)
console.error(err);
} finally {
// shutdown worker pool
await stop()
await stop();
}
})()
})();
```

## Documentation

Dive deep into the documentation to find more examples: **[Guide](GUIDE.md)**

## Known Issues
* **[sanitize worker context](API.md#job-context)**

- **[sanitize worker context](GUIDE.md#job-context)**

## Known Limitations
* **[serialize worker data](API.md#job-data)**

- **[serialize worker data](GUIDE.md#job-data)**

0 comments on commit 61788b6

Please sign in to comment.