aboutsummaryrefslogtreecommitdiff
path: root/tests/worker_api_2_worker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/worker_api_2_worker.cpp')
-rw-r--r--tests/worker_api_2_worker.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/worker_api_2_worker.cpp b/tests/worker_api_2_worker.cpp
index 6db704a5..d7033bc4 100644
--- a/tests/worker_api_2_worker.cpp
+++ b/tests/worker_api_2_worker.cpp
@@ -8,13 +8,17 @@ struct Info {
double d;
};
+int calls = 0; // global state that is not in all workers
+
extern "C" {
void one(char *data, int size) {
+ calls++;
emscripten_worker_respond(data, size);
}
void two(char *data, int size) {
+ calls++;
Info *x = (Info*)data;
x[0].i++;
x[0].f--;
@@ -23,5 +27,18 @@ void two(char *data, int size) {
emscripten_worker_respond(data, size);
}
+void three(char *data, int size) {
+ assert(data == 0);
+ assert(size == 0);
+ calls++;
+ // no response
+}
+
+void four(char *data, int size) {
+ assert(data == 0);
+ assert(size == 0);
+ emscripten_worker_respond((char*)&calls, sizeof(calls));
+}
+
}