Changeset 0cb6c26 for global.c


Ignore:
Timestamp:
May 5, 2009, 1:30:07 AM (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:
1e6e74e
Parents:
e0473d2
Message:
Fix a race that could cause us to miss a SIGINT

When I refactored the previous commits to unmask SIGINT in
owl_global_is_interrupted, I accidentally opened a window for us to miss
a SIGINT for a cycle of the event loop if it arrived in owl_select()
between a call to that functuon and pselect().

Undo that refactoring to make is_interrupted() just poll the flag, add
owl_function_(un)mask_sigint() for convenience, and use them in the
relevant locations.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • global.c

    radee9cc r0cb6c26  
    936936}
    937937
    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  */
    943938int 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;
     939  return g->interrupted;
    954940}
    955941
Note: See TracChangeset for help on using the changeset viewer.