コード例 #1
0
ファイル: iotjs.cpp プロジェクト: 2bright/iotjs
int Start(int argc, char** argv) {
  // Initialize debug print.
  InitDebugSettings();

  // Create environtment.
  Environment* env = Environment::GetEnv();

  // Parse command line arguemnts.
  if (!env->ParseCommandLineArgument(argc, argv)) {
    DLOG("ParseCommandLineArgument failed");
    return 1;
  }

  // Set event loop.
  env->set_loop(uv_default_loop());

  // Initalize JerryScript engine.
  if (!InitJerry(env)) {
    DLOG("InitJerry failed");
    return 1;
  }

  // Start IoT.js
  if (!StartIoTjs(env)) {
    DLOG("StartIoTJs failed");
    return 1;
  }

  // close uv loop.
  //uv_stop(env->loop());
  uv_walk(env->loop(), UvWalkToCloseCallback, NULL);
  uv_run(env->loop(), UV_RUN_DEFAULT);

  int res = uv_loop_close(env->loop());
  IOTJS_ASSERT(res == 0);

  // Release JerryScript engine.
  ReleaseJerry();

  // Release environment.
  Environment::Release();

  // Release debug print setting.
  ReleaseDebugSettings();

  return 0;
}
コード例 #2
0
ファイル: apiemultester.cpp プロジェクト: esevan/libtuv
int apiemultester_entry(void) {
  InitDebugSettings();

#if APIEMUL_DUMP_HEAP_ADDRESS
  char stackVariable;
  lstack = (unsigned long)&stackVariable;
  dump_heap_addr();
#endif

  minar::Scheduler::postCallback(apiemul_main)
                    .delay(minar::milliseconds(500))
                    ;

#if APIEMUL_DUMP_HEAP_ADDRESS
  minar::Scheduler::postCallback(dump_heap_addr)
                    .period(minar::milliseconds(5000))
                    ;
#endif

  return 0;
}
コード例 #3
0
ファイル: iotjs.cpp プロジェクト: bozzmob/iotjs
int Start(int argc, char** argv) {
  InitDebugSettings();

  // Initalize JerryScript engine.
  if (!InitJerry()) {
    DLOG("InitJerry failed");
    return 1;
  }

  // Create environtment.
  Environment* env = Environment::GetEnv();

  // Init environment with argument and uv loop.
  env->Init(argc, argv, uv_default_loop());

  // Start IoT.js
  if (!StartIoTjs(env)) {
    DLOG("StartIoTJs failed");
    return 1;
  }

  // close uv loop.
  //uv_stop(env->loop());
  uv_walk(env->loop(), UvWalkToCloseCallback, NULL);
  uv_run(env->loop(), UV_RUN_DEFAULT);

  int res = uv_loop_close(env->loop());
  IOTJS_ASSERT(res == 0);

  // Release JerryScript engine.
  ReleaseJerry();

  ReleaseDebugSettings();

  return 0;
}