aboutsummaryrefslogtreecommitdiff
path: root/tests/worker_api_2_worker.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-10-22 16:10:06 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-10-22 16:10:06 -0700
commitc11c08094b855e8d6d00d84cbea0f4bf2b18ff72 (patch)
tree372dffb7a78a20848b18869be04b6a0060f1cd61 /tests/worker_api_2_worker.cpp
parent9ff4aded21523a6ca1f3ae642cd70905d6fe8eef (diff)
worker api closure fixes + additional testing
Diffstat (limited to 'tests/worker_api_2_worker.cpp')
-rw-r--r--tests/worker_api_2_worker.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/worker_api_2_worker.cpp b/tests/worker_api_2_worker.cpp
new file mode 100644
index 00000000..6db704a5
--- /dev/null
+++ b/tests/worker_api_2_worker.cpp
@@ -0,0 +1,27 @@
+#include <assert.h>
+#include <emscripten.h>
+
+struct Info {
+ int i;
+ float f;
+ char c;
+ double d;
+};
+
+extern "C" {
+
+void one(char *data, int size) {
+ emscripten_worker_respond(data, size);
+}
+
+void two(char *data, int size) {
+ Info *x = (Info*)data;
+ x[0].i++;
+ x[0].f--;
+ x[0].c++;
+ x[0].d--;
+ emscripten_worker_respond(data, size);
+}
+
+}
+