Changeset adee9cc for global.c


Ignore:
Timestamp:
May 4, 2009, 9:55:11 PM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
d6bd3f1
Parents:
790ab12
git-author:
Nelson Elhage <nelhage@mit.edu> (05/03/09 15:31:50)
git-committer:
Nelson Elhage <nelhage@mit.edu> (05/04/09 21:55:11)
Message:
Enable signals, and add an interrupted flag.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • global.c

    rf34dd65 radee9cc  
    116116  owl_list_create(&(g->dispatchlist));
    117117  g->timerlist = NULL;
     118  g->interrupted = FALSE;
    118119}
    119120
     
    934935  return &(g->timerlist);
    935936}
     937
     938/*
     939 * Note: This must be called with SIGINT masked in order to avoid
     940 * races. This will unset the interrupt flag and unblock SIGINT before
     941 * returning.
     942 */
     943int owl_global_is_interrupted(owl_global *g) {
     944  int interrupted;
     945  sigset_t intr;
     946  sigemptyset(&intr);
     947  sigaddset(&intr, SIGINT);
     948
     949  interrupted = g->interrupted;
     950  g->interrupted = 0;
     951
     952  sigprocmask(SIG_UNBLOCK, &intr, NULL);
     953  return interrupted;
     954}
     955
     956void owl_global_set_interrupted(owl_global *g) {
     957  g->interrupted = 1;
     958}
     959
     960void owl_global_unset_interrupted(owl_global *g) {
     961  g->interrupted = 0;
     962}
Note: See TracChangeset for help on using the changeset viewer.