예제 #1
0
void app_start_gui_for_session(session *s, app_context_t *app_context) {
  session_service *serv = app_context->session_serv;
  gui_context_t *gc = gui_create(s, serv);
  pair_session_with_gui(s, (void *) gc, (void *) app_context);
  jnx_thread *user_input_thread =
      jnx_thread_create(read_user_input_loop, (void *) gc);
  jnx_char *message;
  while (0 < session_message_read(s, (jnx_uint8 **) &message)) {
    gui_receive_message(gc, message);
  }
  if (QUIT_NONE == gc->quit_hint) {
    gc->quit_hint = QUIT_ON_NEXT_USER_INPUT;
  }
  // wait for user input thread to complete
  pthread_join(user_input_thread->system_thread, NULL);
}
예제 #2
0
static jnx_int32 listen_for_discovery_packets(discovery_service *svc) {
  svc->listening_thread = jnx_thread_create(discovery_loop, (void *) svc);
  ensure_listening_on_port(svc->port);
  return 0;
}
예제 #3
0
jnx_int32 broadcast_update_strategy(discovery_service *svc) {
  svc->update_thread = jnx_thread_create(broadcast_update_loop, (void *) svc);
  return 0;
}
예제 #4
0
jnx_int32 polling_update_strategy(discovery_service *svc) {
  svc->update_thread = jnx_thread_create(polling_update_loop, (void *) svc);
  return 0;
}