- Timestamp:
- Nov 5, 2013, 12:50:56 PM (10 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- d600e1863951bfc5135d0138b61badb20b1ec70a
- Parents:
- 8c982c34545a8ef6ec86afcbb224757c7dffcd0f
- git-author:
- Andreas Steenpass <steenpass@mathematik.uni-kl.de>2013-11-05 12:50:56+01:00
- git-committer:
- Andreas Steenpass <steenpass@mathematik.uni-kl.de>2013-11-06 13:20:27+01:00
- Location:
- Singular
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/cntrlc.cc
r8c982c3 r659a7a 30 30 #include <Singular/cntrlc.h> 31 31 #include <Singular/feOpt.h> 32 #include <Singular/misc_ip.h> 32 33 #include <Singular/si_signals.h> 33 34 #include <Singular/links/silink.h> … … 88 89 } 89 90 91 volatile BOOLEAN do_shutdown = FALSE; 92 volatile int defer_shutdown = 0; 93 90 94 void sig_term_hdl(int /*sig*/) 91 95 { 92 if (ssiToBeClosed_inactive) 93 { 94 ssiToBeClosed_inactive=FALSE; 95 while (ssiToBeClosed!=NULL) 96 { 97 slClose(ssiToBeClosed->l); 98 if (ssiToBeClosed==NULL) break; 99 ssiToBeClosed=(link_list)ssiToBeClosed->next; 100 } 101 exit(1); 102 } 103 //else: we already shutting down: let's do m2_end ist work 96 do_shutdown = TRUE; 97 if (!defer_shutdown) 98 { 99 m2_end(1); 100 } 104 101 } 105 102 -
Singular/cntrlc.h
r8c982c3 r659a7a 19 19 /* TRUE for child of a fork or started with --batch*/ 20 20 21 /* for deferring the call of m2_end() in SIGTERM handler if necessary */ 22 extern volatile BOOLEAN do_shutdown; 23 extern volatile int defer_shutdown; 24 21 25 #endif -
Singular/misc_ip.cc
r8c982c3 r659a7a 1044 1044 */ 1045 1045 extern "C" { 1046 /* Note: We cannot use a mutex here because mutexes are not async-safe, but 1047 * m2_end is called by sig_term_hdl(). Anyway, the race condition in the first 1048 * few lines of m2_end() should not matter. 1049 */ 1050 volatile BOOLEAN m2_end_called = FALSE; 1046 1051 1047 1052 void m2_end(int i) 1048 1053 { 1049 fe_reset_input_mode(); 1050 #ifdef PAGE_TEST 1051 mmEndStat(); 1052 #endif 1053 fe_reset_input_mode(); 1054 if (ssiToBeClosed_inactive) 1055 { 1056 link_list hh=ssiToBeClosed; 1057 while(hh!=NULL) 1058 { 1059 //Print("close %s\n",hh->l->name); 1060 slPrepClose(hh->l); 1061 hh=(link_list)hh->next; 1062 } 1063 ssiToBeClosed_inactive=FALSE; 1064 1065 idhdl h = currPack->idroot; 1066 while(h != NULL) 1067 { 1068 if(IDTYP(h) == LINK_CMD) 1069 { 1070 idhdl hh=h->next; 1071 //Print("kill %s\n",IDID(h)); 1072 killhdl(h, currPack); 1073 h = hh; 1054 if (!m2_end_called) 1055 { 1056 m2_end_called = TRUE; 1057 fe_reset_input_mode(); 1058 #ifdef PAGE_TEST 1059 mmEndStat(); 1060 #endif 1061 fe_reset_input_mode(); 1062 if (ssiToBeClosed_inactive) 1063 { 1064 link_list hh=ssiToBeClosed; 1065 while(hh!=NULL) 1066 { 1067 //Print("close %s\n",hh->l->name); 1068 slPrepClose(hh->l); 1069 hh=(link_list)hh->next; 1070 } 1071 ssiToBeClosed_inactive=FALSE; 1072 1073 idhdl h = currPack->idroot; 1074 while(h != NULL) 1075 { 1076 if(IDTYP(h) == LINK_CMD) 1077 { 1078 idhdl hh=h->next; 1079 //Print("kill %s\n",IDID(h)); 1080 killhdl(h, currPack); 1081 h = hh; 1082 } 1083 else 1084 { 1085 h = h->next; 1086 } 1087 } 1088 hh=ssiToBeClosed; 1089 while(hh!=NULL) 1090 { 1091 //Print("close %s\n",hh->l->name); 1092 slClose(hh->l); 1093 hh=ssiToBeClosed; 1094 } 1095 } 1096 if (!singular_in_batchmode) 1097 { 1098 if (i<=0) 1099 { 1100 if (TEST_V_QUIET) 1101 { 1102 if (i==0) 1103 printf("Auf Wiedersehen.\n"); 1104 else 1105 printf("\n$Bye.\n"); 1106 } 1107 //#ifdef sun 1108 // #ifndef __svr4__ 1109 // _cleanup(); 1110 // _exit(0); 1111 // #endif 1112 //#endif 1113 i=0; 1074 1114 } 1075 1115 else 1076 1116 { 1077 h = h->next;1078 }1079 }1080 hh=ssiToBeClosed;1081 while(hh!=NULL)1082 {1083 //Print("close %s\n",hh->l->name);1084 slClose(hh->l);1085 hh=ssiToBeClosed;1086 }1087 }1088 if (!singular_in_batchmode)1089 {1090 if (i<=0)1091 {1092 if (TEST_V_QUIET)1093 {1094 if (i==0)1095 printf("Auf Wiedersehen.\n");1096 else1097 printf("\n$Bye.\n");1098 }1099 //#ifdef sun1100 // #ifndef __svr4__1101 // _cleanup();1102 // _exit(0);1103 // #endif1104 //#endif1105 i=0;1106 }1107 else1108 {1109 1117 printf("\nhalt %d\n",i); 1110 } 1111 } 1112 exit(i); 1118 } 1119 } 1120 exit(i); 1121 } 1113 1122 } 1114 1123 }
Note: See TracChangeset
for help on using the changeset viewer.