aboutsummaryrefslogtreecommitdiff
path: root/tests/hello_world_worker.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-12 16:02:19 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-12 16:02:19 -0800
commit8d7e09462e4f4c5fa10725d4b04caa7be5778749 (patch)
tree04d9dbec50289a1bd95a8bd7645ab507713477fe /tests/hello_world_worker.cpp
parent94476d0fcde4f3b55dd05014c7394ba2d088f076 (diff)
fixes to allow generated code to run in a web worker
Diffstat (limited to 'tests/hello_world_worker.cpp')
-rw-r--r--tests/hello_world_worker.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/hello_world_worker.cpp b/tests/hello_world_worker.cpp
new file mode 100644
index 00000000..5ea26d91
--- /dev/null
+++ b/tests/hello_world_worker.cpp
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <emscripten.h>
+
+int main()
+{
+ printf("you should not see this text when in a worker!\n"); // this should not crash, but also should not show up anywhere if you are in a worker
+ emscripten_run_script("if (typeof postMessage !== 'undefined') { postMessage('hello from worker!') }");
+}
+