Exemple #1
0
void rarch_main_data_msg_queue_push(unsigned type,
      const char *msg, const char *msg2,
      unsigned prio, unsigned duration, bool flush)
{
   char new_msg[PATH_MAX_LENGTH] = {0};
   msg_queue_t *queue            = NULL;

   switch(type)
   {
      case DATA_TYPE_NONE:
         break;
      case DATA_TYPE_FILE:
         queue = rarch_main_data_nbio_get_msg_queue_ptr();
         if (!queue)
            return;
         snprintf(new_msg, sizeof(new_msg), "%s|%s", msg, msg2);
         break;
      case DATA_TYPE_IMAGE:
         queue = rarch_main_data_nbio_image_get_msg_queue_ptr();
         if (!queue)
            return;
         snprintf(new_msg, sizeof(new_msg), "%s|%s", msg, msg2);
         break;
#ifdef HAVE_NETWORKING
      case DATA_TYPE_HTTP:
         queue = rarch_main_data_http_get_msg_queue_ptr();
         snprintf(new_msg, sizeof(new_msg), "%s|%s", msg, msg2);
         break;
#endif
#ifdef HAVE_OVERLAY
      case DATA_TYPE_OVERLAY:
         snprintf(new_msg, sizeof(new_msg), "%s|%s", msg, msg2);
         break;
#endif
#ifdef HAVE_LIBRETRODB
      case DATA_TYPE_DB:
         queue = rarch_main_data_db_get_msg_queue_ptr();
         snprintf(new_msg, sizeof(new_msg), "%s|%s", msg, msg2);
         break;
#endif
   }

   if (!queue)
      return;

   if (flush)
      msg_queue_clear(queue);
   msg_queue_push(queue, new_msg, prio, duration);
}
Exemple #2
0
void rarch_main_data_msg_queue_push(unsigned type,
      const char *msg, const char *msg2,
      unsigned prio, unsigned duration, bool flush)
{
   char new_msg[PATH_MAX_LENGTH];
   msg_queue_t *queue            = NULL;
   settings_t     *settings      = config_get_ptr();

   (void)settings;

   switch(type)
   {
      case DATA_TYPE_NONE:
         break;
      case DATA_TYPE_FILE:
         queue = rarch_main_data_nbio_get_msg_queue_ptr();
         fill_pathname_join_delim(new_msg, msg, msg2, '|', sizeof(new_msg));
         break;
      case DATA_TYPE_IMAGE:
         queue = rarch_main_data_nbio_image_get_msg_queue_ptr();
         fill_pathname_join_delim(new_msg, msg, msg2, '|', sizeof(new_msg));
         break;
#ifdef HAVE_NETWORKING
      case DATA_TYPE_HTTP:
         queue = rarch_main_data_http_get_msg_queue_ptr();
         fill_pathname_join_delim(new_msg, msg, msg2, '|', sizeof(new_msg));
         break;
#endif
#ifdef HAVE_OVERLAY
      case DATA_TYPE_OVERLAY:
         fill_pathname_join_delim(new_msg, msg, msg2, '|', sizeof(new_msg));
         break;
#endif
#ifdef HAVE_LIBRETRODB
      case DATA_TYPE_DB:
         queue = rarch_main_data_db_get_msg_queue_ptr();
         fill_pathname_join_delim(new_msg, msg, msg2, '|', sizeof(new_msg));
         break;
#endif
   }

   if (!queue)
      return;

   if (flush)
      msg_queue_clear(queue);
   msg_queue_push(queue, new_msg, prio, duration);

#ifdef HAVE_THREADS
   if (settings->threaded_data_runloop_enable)
   {
      if (!g_data_runloop.thread_inited)
         rarch_main_data_thread_init();
      else
      {
         slock_lock(g_data_runloop.cond_lock);
         scond_signal(g_data_runloop.cond);
         slock_unlock(g_data_runloop.cond_lock);
      }
   }
#endif
}