summaryrefslogtreecommitdiffhomepage
path: root/examples/web/physac/pthread-main.js
diff options
context:
space:
mode:
Diffstat (limited to 'examples/web/physac/pthread-main.js')
-rw-r--r--examples/web/physac/pthread-main.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/examples/web/physac/pthread-main.js b/examples/web/physac/pthread-main.js
index 3f09431..e277f2a 100644
--- a/examples/web/physac/pthread-main.js
+++ b/examples/web/physac/pthread-main.js
@@ -77,6 +77,9 @@ this.onmessage = function(e) {
assert(STACK_MAX > STACK_BASE);
Runtime.establishStackSpace(e.data.stackBase, e.data.stackBase + e.data.stackSize);
var result = 0;
+//#if STACK_OVERFLOW_CHECK
+ if (typeof writeStackCookie === 'function') writeStackCookie();
+//#endif
PThread.receiveObjectTransfer(e.data);
@@ -85,11 +88,15 @@ this.onmessage = function(e) {
try {
// HACK: Some code in the wild has instead signatures of form 'void *ThreadMain()', which seems to be ok in native code.
// To emulate supporting both in test suites, use the following form. This is brittle!
- if (typeof asm['dynCall_ii'] !== 'undefined') {
- result = asm.dynCall_ii(e.data.start_routine, e.data.arg); // pthread entry points are always of signature 'void *ThreadMain(void *arg)'
+ if (typeof Module['asm']['dynCall_ii'] !== 'undefined') {
+ result = Module['asm'].dynCall_ii(e.data.start_routine, e.data.arg); // pthread entry points are always of signature 'void *ThreadMain(void *arg)'
} else {
- result = asm.dynCall_i(e.data.start_routine); // as a hack, try signature 'i' as fallback.
+ result = Module['asm'].dynCall_i(e.data.start_routine); // as a hack, try signature 'i' as fallback.
}
+//#if STACK_OVERFLOW_CHECK
+ if (typeof checkStackCookie === 'function') checkStackCookie();
+//#endif
+
} catch(e) {
if (e === 'Canceled!') {
PThread.threadCancel();