aboutsummaryrefslogtreecommitdiff
path: root/src/libmain
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-05-11 18:05:44 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-05-11 18:05:44 +0000
commitc8d3882cdc8f9e22c58af285c1996265c1af75d5 (patch)
treebca454268647fa6edf6cd349fc92543b9789d188 /src/libmain
parentaea436503e9126b06cd15acf1f0c6b738ffbc7de (diff)
* True parallel builds. Nix can now run as many build jobs in
parallel as possible (similar to GNU Make's `-j' switch). This is useful on SMP systems, but it is especially useful for doing builds on multiple machines. The idea is that a large derivation is initiated on one master machine, which then distributes sub-derivations to any number of slave machines. This should not happen synchronously or in lock-step, so the master must be capable of dealing with multiple parallel build jobs. We now have the infrastructure to support this. TODO: substitutes are currently broken.
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/shared.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index fce427106..d9cc990f9 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -15,9 +15,15 @@ extern "C" {
#include "config.h"
+volatile sig_atomic_t blockInt = 0;
+
+
void sigintHandler(int signo)
{
- _isInterrupted = 1;
+ if (!blockInt) {
+ _isInterrupted = 1;
+ blockInt = 1;
+ }
}
@@ -150,7 +156,17 @@ int main(int argc, char * * argv)
#endif
try {
- initAndRun(argc, argv);
+ try {
+ initAndRun(argc, argv);
+ } catch (...) {
+ /* Subtle: we have to make sure that any `interrupted'
+ condition is discharged before we reach printMsg()
+ below, since otherwise it will throw an (uncaught)
+ exception. */
+ blockInt = 1; /* ignore further SIGINTs */
+ _isInterrupted = 0;
+ throw;
+ }
} catch (UsageError & e) {
printMsg(lvlError,
format(