Expose libvips thread pool size

This commit is contained in:
Lovell Fuller
2014-09-03 19:52:03 +01:00
parent 87f6e83988
commit eb3e739f7b
5 changed files with 83 additions and 37 deletions

View File

@@ -775,6 +775,20 @@ NAN_METHOD(cache) {
NanReturnValue(cache);
}
/*
Get and set size of thread pool
*/
NAN_METHOD(concurrency) {
NanScope();
// Set concurrency
if (args[0]->IsInt32()) {
vips_concurrency_set(args[0]->Int32Value());
}
// Get concurrency
NanReturnValue(NanNew<Number>(vips_concurrency_get()));
}
/*
Get internal counters (queued tasks, processing tasks)
*/
@@ -807,6 +821,7 @@ extern "C" void init(Handle<Object> target) {
NODE_SET_METHOD(target, "metadata", metadata);
NODE_SET_METHOD(target, "resize", resize);
NODE_SET_METHOD(target, "cache", cache);
NODE_SET_METHOD(target, "concurrency", concurrency);
NODE_SET_METHOD(target, "counters", counters);
}