forked from davisp/emonk
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A big update that needs your help with testing.
This passes all of my various smoke tests. I'd consider this a very pre-alpha that could use some more abuse and eye balls. If you find a bug be sure and open an issue so I can try and get it fixed. There was a dead lock when processing jobs. I refactored quite a bit of the concurrency code to try and simplify and streamline things. I'm now using opaque pointers considerably to try and limit the scope of critical sections. The basic concurrency concept is such: There are a given number of workers that can process requests for JS execution. This number of workers can be interrogated and changed using emonk:num_workers/0, emonk:add_worker/0, and emonk:rem_worker/0. A Context is required to run JavaScript code. It is created via emonk:new_context/0 and emonk:new_context/1. The optional parameter is for specifying a stack size in bytes. Once a context is created you can eval code with emonk:eval/2,3 or call functions in the global scope with emonk:call/3,4. Generally speaking you'll eval some code and then call some named function. The eval call takes a context on which to run, the script as a binary, and an optional timeout. The call function takes a context, a function name, an array of arguments, and an optional timeout. The general effect of eval and call is to place a job request onto a queue associated with the context. A context will then process the jobs in the order retrieved and send the results back to Erlang. Contexts are processed in a round robin order and a context can only process a single job at a time. So, if you have a very active context with lots of requests, and a request comes into an idle context, the idle context will jump in front of the busy one minus the job it might currently be processing. Hopefully that makes sense.
- Loading branch information
Showing
19 changed files
with
995 additions
and
728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.