https://github.com/benoitc/emonk_helper
Some extensiosn to ease the use of emonk (http://github.com/davisp/emonk)
https://github.com/benoitc/emonk_helper
Last synced: 5 months ago
JSON representation
Some extensiosn to ease the use of emonk (http://github.com/davisp/emonk)
- Host: GitHub
- URL: https://github.com/benoitc/emonk_helper
- Owner: benoitc
- License: apache-2.0
- Created: 2011-09-04T13:07:32.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-09-04T21:02:55.000Z (over 14 years ago)
- Last Synced: 2025-10-08T00:38:16.359Z (5 months ago)
- Language: Erlang
- Homepage:
- Size: 200 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
emonk_helper
============
Some [emonk](http://github.com/davisp/emonk) extensions to ease its usage
in applications.
For now it provides an emonk contexts pool management. Each emonk
context is a thread so you have to reduce their number.
The pool allows simple javascript call in a context and multiple javascriptcall to a context.
Requirements
------------
1. Latest emonk.
2. R14A or superior.
Build
-----
$ git clone git://github.com/benoitc/emonk_helper.git
$ cd emonk_helper
$ make
Run
---
1> application:start(emonk).
ok
2> application:start(emonk_helper).
ok
3> emonk_helper:start_pool(js_pool, 10).
{ok,<0.41.0>}
4> emonk_ctx_pool:poolsize(js_pool).
10
5> emonk_helper:eval(js_pool, <<"var f = 2; f*3;">>, 3).
{ok,6}
6> emonk_ctx_pool:poolsize(js_pool).
10
7> {ok, Ctx} = emonk_helper:reserve_batch_ctx(js_pool, 4).
{ok,<0.47.0>}
8> emonk_ctx_pool:poolsize(js_pool).
9
10> emonk_ctx:eval(Ctx, <<"var g = function(x) {return x*4;};">>).
{ok,undefined}
11> emonk_ctx:call(Ctx, <<"g">>, [9]).
{ok,36}
12> emonk_ctx_pool:poolsize(js_pool).
9
13> emonk_ctx:finish_batch(Ctx).
ok
14> emonk_ctx_pool:poolsize(js_pool).
10