~ubuntu-branches/ubuntu/vivid/emscripten/vivid-proposed

« back to all changes in this revision

Viewing changes to tests/doublestart.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2014-01-19 14:12:40 UTC
  • mfrom: (4.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140119141240-nfiw0p8033oitpfz
Tags: 1.9.0~20140119~7dc8c2f-1
* New snapshot release (Closes: #733714)
* Provide sources for javascript and flash. Done in orig-tar.sh
  Available in third_party/websockify/include/web-socket-js/src/
  (Closes: #735903)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <emscripten.h>
 
3
 
 
4
int times = 0;
 
5
 
 
6
void later(void* nada) {
 
7
  int result = times;
 
8
  REPORT_RESULT();
 
9
}
 
10
 
 
11
void main_loop(void) {
 
12
  static int cnt = 0;
 
13
  if (++cnt >= 10) emscripten_cancel_main_loop();
 
14
}
 
15
 
 
16
int main(void) {
 
17
  emscripten_async_call(later, NULL, 2000);
 
18
  times++;
 
19
  printf("This should only appear once.\n");
 
20
  emscripten_set_main_loop(main_loop, 10, 0);
 
21
  return 0;
 
22
}
 
23