summaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-04-05 10:53:09 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-04-05 10:53:09 -0700
commit8098fe7e06ff47d6944afd47158aac22d9354d32 (patch)
treec2620e8d9b0813357b19f9c1dd1ad0a554f4c2ce /src/preamble.js
parent1c504965bdb643dc338774a4eb5027a0030ae837 (diff)
refactor runtime initialization
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/preamble.js b/src/preamble.js
index e7778b30..f85cf4f3 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -718,7 +718,11 @@ var __ATINIT__ = []; // functions called during startup
var __ATMAIN__ = []; // functions called when main() is to be run
var __ATEXIT__ = []; // functions called during shutdown
-function initRuntime() {
+var runtimeInitialized = false;
+
+function ensureInitRuntime() {
+ if (runtimeInitialized) return;
+ runtimeInitialized = true;
callRuntimeCallbacks(__ATINIT__);
}
function preMain() {