Permalink
Browse files

Lock spidermonkey_drv.so in memory so NSPR thread cleanup code runs.

Fixes SEGV under R15B
  • Loading branch information...
1 parent 8006549 commit 11557daaec63db3fab270ba5293e38abf3efc135 @jonmeredith jonmeredith committed Jun 15, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 c_src/spidermonkey_drv.c
View
7 c_src/spidermonkey_drv.c
@@ -193,6 +193,13 @@ static ErlDrvData start(ErlDrvPort port, char *cmd) {
retval->atom_ok = driver_mk_atom((char *) "ok");
retval->atom_error = driver_mk_atom((char *) "error");
retval->atom_unknown_cmd = driver_mk_atom((char *) "unknown_command");
+
+ /* Lock the driver in memory. NSPR registers some thread cleanup
+ ** code in _pt_thread_death on the async thread pool which
+ ** gets called after spidermonkey_drv.so is unloaded on R15B
+ */
+ driver_lock_driver(port);
+
return (ErlDrvData) retval;
}

0 comments on commit 11557da

Please sign in to comment.