I am currently working on an embeddable scripting language based on the NJS Javascript engine. So far I have created a module system that allows the linking in of shared libs and javascript code at runtime, plus the concept of an "autolink", whereby certain extensions to the interpreter can be automatically loaded when first accessed. For example, I have removed the Date type from the core interpreter, but if the VM finds bytecode that creates a new Date object, it will automatically link in the Date module. This keeps the core VM codebase nice and small. I have also added support for things like GDBM, MySQL, and socket operations.
Anyway, I am currently investigating adding threading support and am trying to investigate the best strategy for doing so. So far I have decided on the Pth library but am uncertain of the best way to integrate it into the VM. Should I add threading directly into the VM (ie... create bytecodes for the handling of threads), or just create an SO that wraps Pth and can be imported? Or, do I need to add support for Pth in the core VM? It has been my experience that working with threading libraries can be somewhat messy and so I am trying to find the best way to integrate support without (hopefull) having to gut the VM code too much. Any suggestions are greatly appreciated.
