| 45 | } |
| 46 | |
| 47 | void c2(char *data, int size, void *arg) { // tests queuing up several messages, each with different data |
| 48 | assert((long)arg == stage); |
| 49 | Info *x2 = (Info*)data; |
| 50 | |
| 51 | int i = stage - 3; |
| 52 | printf("c2-%d\n", i); |
| 53 | printf("%d, %.2f, %d, %.2f\n", x2[0].i, x2[0].f, x2[0].c, x2[0].d); |
| 54 | printf("%d, %.2f, %d, %.2f\n", x[i].i, x[i].f, x[i].c, x[i].d); |
| 55 | assert(x2[0].i == x[i].i+1); |
| 56 | assert(x2[0].f == x[i].f-1); |
| 57 | assert(x2[0].c == x[i].c+1); |
| 58 | assert(x2[0].d == x[i].d-1); |
| 59 | |
| 60 | if (stage == 5) { |
| 61 | int w2 = emscripten_create_worker("worker.js"); |
| 62 | emscripten_call_worker(w2, "three", NULL, 0, NULL, (void*)6); // bump calls in new worker, once |
| 63 | |
| 64 | emscripten_call_worker(w1, "four", NULL, 0, c3, (void*)7); |
| 65 | emscripten_call_worker(w2, "four", NULL, 0, c3, (void*)8); |
| 66 | } |
| 67 | stage++; |
| 68 | } |
| 69 | |
| 70 | void c1(char *data, int size, void *arg) { // tests copying + buffer enlargement |
| 71 | assert((long)arg == stage); |