aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-04-24 19:44:02 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-04-24 19:44:02 -0700
commit9f0ba583d6ed8ed830cc2871d91d3339d36d36d7 (patch)
tree5b5c701db7fde57fc205e6f4106ea987b624ff8d /src
parent2fb5e321d9c1ed6701cfc6689bcf78eb6c22e41f (diff)
support for __cxa_atexit argument
Diffstat (limited to 'src')
-rw-r--r--src/library.js4
-rw-r--r--src/preamble.js5
2 files changed, 5 insertions, 4 deletions
diff --git a/src/library.js b/src/library.js
index c7fe551b..b2106288 100644
--- a/src/library.js
+++ b/src/library.js
@@ -514,8 +514,8 @@ var Library = {
throw 'exit(' + status + ') called, at ' + new Error().stack;
},
- atexit: function(func) {
- __ATEXIT__.push(func);
+ atexit: function(func, arg) {
+ __ATEXIT__.push({ func: func, arg: arg });
},
__cxa_atexit: 'atexit',
diff --git a/src/preamble.js b/src/preamble.js
index 0232ff20..44f5c876 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -287,11 +287,12 @@ function __initializeRuntime__() {
function __shutdownRuntime__() {
while( __ATEXIT__.length > 0) {
- var func = __ATEXIT__.pop();
+ var atexit = __ATEXIT__.pop();
+ var func = atexit.func;
if (typeof func === 'number') {
func = FUNCTION_TABLE[func];
}
- func();
+ func(atexit.arg);
}
}