NickNaso / ghostscript4js

Ghostscript4JS binds the Ghostscript C API to the Node.JS world.
http://www.nacios.it
Apache License 2.0
68 stars 19 forks source link

Possible handle multithread #7

Closed NickNaso closed 7 years ago

NickNaso commented 7 years ago

Is it possible to build a multithread system to handle the instance of Ghostscript?

NickNaso commented 7 years ago

This is what say Ghostscript documentation

Create a new instance of Ghostscript. This instance is passed to most other gsapi functions. The caller_handle will be provided to callback functions. Unless Ghostscript has been compiled with the GS_THREADSAFE define, only one instance at a time is supported. Historically, Ghostscript has only supported a single instance; any attempt to create more than one at a time would result in gsapi_new_instance returning an error. Experimental work has been done to lift this restriction; if Ghostscript is compiled with the GS_THREADSAFE define then multiple concurrent instances are permitted. While the core Ghostscript devices are believed to be thread safe now, certain devices are known not to be (particularly the contrib devices). The makefiles currently make no attempt to exclude these from builds. If you enable GS_THREADSAFE then you should check to ensure that you do not rely on such devices (check for global variable use).

So as expressd in documentation there are some devices that not support multiple Ghostscript instances, so for now my idea is to be coherent and safe and secure with all the devices.

crapthings commented 5 years ago

any possible to make this concurrent?