Changes in / [a902ebb:9b3167b]


Ignore:
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • global.c

    r0792d99 r219f52c  
    1010
    1111  g_type_init();
    12 #if !GLIB_CHECK_VERSION(2, 31, 0)
    1312  g_thread_init(NULL);
    14 #endif
    1513
    1614  owl_select_init();
     
    102100
    103101  g->interrupt_count = 0;
    104 #if GLIB_CHECK_VERSION(2, 31, 0)
    105   g_mutex_init(&g->interrupt_lock);
    106 #else
    107102  g->interrupt_lock = g_mutex_new();
    108 #endif
    109103}
    110104
     
    905899}
    906900
    907 static GMutex *owl_global_get_interrupt_lock(owl_global *g)
    908 {
    909 #if GLIB_CHECK_VERSION(2, 31, 0)
    910   return &g->interrupt_lock;
    911 #else
    912   return g->interrupt_lock;
    913 #endif
    914 }
    915 
    916901void owl_global_add_interrupt(owl_global *g) {
    917902  /* TODO: This can almost certainly be done with atomic
    918903   * operations. Whatever. */
    919   g_mutex_lock(owl_global_get_interrupt_lock(g));
     904  g_mutex_lock(g->interrupt_lock);
    920905  g->interrupt_count++;
    921   g_mutex_unlock(owl_global_get_interrupt_lock(g));
     906  g_mutex_unlock(g->interrupt_lock);
    922907}
    923908
    924909bool owl_global_take_interrupt(owl_global *g) {
    925910  bool ans = false;
    926   g_mutex_lock(owl_global_get_interrupt_lock(g));
     911  g_mutex_lock(g->interrupt_lock);
    927912  if (g->interrupt_count > 0) {
    928913    ans = true;
    929914    g->interrupt_count--;
    930915  }
    931   g_mutex_unlock(owl_global_get_interrupt_lock(g));
     916  g_mutex_unlock(g->interrupt_lock);
    932917  return ans;
    933918}
  • logging.c

    r0792d99 r0a9ffc5  
    436436void owl_log_init(void)
    437437{
     438  GError *error = NULL;
    438439  log_context = g_main_context_new();
    439 #if GLIB_CHECK_VERSION(2, 31, 0)
    440   logging_thread = g_thread_new("logging",
    441                                 owl_log_thread_func,
    442                                 NULL);
    443 #else
    444   GError *error = NULL;
    445440  logging_thread = g_thread_create(owl_log_thread_func,
    446441                                   NULL,
     
    453448    exit(1);
    454449  }
    455 #endif
    456450 
    457451}
  • owl.h

    rcb124fc6 r219f52c  
    596596  char *kill_buffer;
    597597  int interrupt_count;
    598 #if GLIB_CHECK_VERSION(2, 31, 0)
    599   GMutex interrupt_lock;
    600 #else
    601598  GMutex *interrupt_lock;
    602 #endif
    603599} owl_global;
    604600
Note: See TracChangeset for help on using the changeset viewer.