mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
ircd::js: Lock context and run js dtor even on bailout for now.
This commit is contained in:
parent
4f34311f5f
commit
b3c46af4a1
1 changed files with 17 additions and 0 deletions
17
ircd/js.cc
17
ircd/js.cc
|
@ -55,6 +55,7 @@ struct log::log log
|
|||
//
|
||||
|
||||
ircd::js::init::init()
|
||||
try
|
||||
{
|
||||
log.info("Initializing the JS engine [%s: %s]",
|
||||
"SpiderMonkey",
|
||||
|
@ -72,11 +73,27 @@ ircd::js::init::init()
|
|||
mc = context(main, context_opts);
|
||||
log.info("Initialized main JS Runtime and context (version: '%s')",
|
||||
version(mc));
|
||||
|
||||
{
|
||||
context::lock lock;
|
||||
ircd::mods::load("kernel");
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
this->~init();
|
||||
throw;
|
||||
}
|
||||
|
||||
ircd::js::init::~init()
|
||||
noexcept
|
||||
{
|
||||
if(cx && !!*cx)
|
||||
{
|
||||
context::lock lock;
|
||||
ircd::mods::unload("kernel");
|
||||
}
|
||||
|
||||
log.info("Terminating the main JS Runtime");
|
||||
|
||||
// Assign empty objects to free and reset
|
||||
|
|
Loading…
Reference in a new issue