Changeset c748e8a


Ignore:
Timestamp:
Oct 29, 2012, 11:04:56 PM (9 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master
Children:
cb124fc6
Parents:
9b3167b
git-author:
Anders Kaseorg <andersk@mit.edu> (06/26/12 01:54:16)
git-committer:
Anders Kaseorg <andersk@mit.edu> (10/29/12 23:04:56)
Message:
Abstract g->interrupt_lock

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • global.c

    r219f52c rc748e8a  
    899899}
    900900
     901static GMutex *owl_global_get_interrupt_lock(owl_global *g)
     902{
     903  return g->interrupt_lock;
     904}
     905
    901906void owl_global_add_interrupt(owl_global *g) {
    902907  /* TODO: This can almost certainly be done with atomic
    903908   * operations. Whatever. */
    904   g_mutex_lock(g->interrupt_lock);
     909  g_mutex_lock(owl_global_get_interrupt_lock(g));
    905910  g->interrupt_count++;
    906   g_mutex_unlock(g->interrupt_lock);
     911  g_mutex_unlock(owl_global_get_interrupt_lock(g));
    907912}
    908913
    909914bool owl_global_take_interrupt(owl_global *g) {
    910915  bool ans = false;
    911   g_mutex_lock(g->interrupt_lock);
     916  g_mutex_lock(owl_global_get_interrupt_lock(g));
    912917  if (g->interrupt_count > 0) {
    913918    ans = true;
    914919    g->interrupt_count--;
    915920  }
    916   g_mutex_unlock(g->interrupt_lock);
     921  g_mutex_unlock(owl_global_get_interrupt_lock(g));
    917922  return ans;
    918923}
Note: See TracChangeset for help on using the changeset viewer.