MCPcopy Create free account
hub / github.com/Singular/Singular / m2_end

Function m2_end

Singular/misc_ip.cc:1100–1206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1098volatile BOOLEAN m2_end_called = FALSE;
1099
1100void m2_end(int i)
1101{
1102 if (!m2_end_called)
1103 {
1104 EXTERN_VAR FILE* File_Profiling;
1105 EXTERN_VAR FILE* File_Log;
1106 EXTERN_VAR BOOLEAN File_Log_written;
1107 if (File_Profiling!=NULL) { fclose(File_Profiling); File_Profiling=NULL; }
1108 if (File_Log!=NULL)
1109 {
1110 fclose(File_Log);
1111 File_Log=NULL;
1112 if (File_Log_written==FALSE) // remove empty logs
1113 {
1114 int pid=getpid();
1115 char buf[20];
1116 snprintf(buf,20,"/tmp/sing_log.%d",pid);
1117 remove(buf);
1118 }
1119 }
1120 m2_end_called = TRUE;
1121#ifdef HAVE_SIMPLEIPC
1122 for (int j = SIPC_MAX_SEMAPHORES-1; j >= 0; j--)
1123 {
1124 if (semaphore[j] != NULL)
1125 {
1126 while (sem_acquired[j] > 0)
1127 {
1128#if PORTABLE_SEMAPHORES
1129 sem_post(semaphore[j]->sig);
1130#else
1131 sem_post(semaphore[j]);
1132#endif
1133 sem_acquired[j]--;
1134 }
1135 }
1136 }
1137#endif // HAVE_SIMPLEIPC
1138 monitor(NULL,0);
1139#ifdef PAGE_TEST
1140 mmEndStat();
1141#endif
1142 fe_reset_input_mode();
1143 if (ssiToBeClosed_inactive)
1144 {
1145 link_list hh=ssiToBeClosed;
1146 while(hh!=NULL)
1147 {
1148 //Print("close %s\n",hh->l->name);
1149 slPrepClose(hh->l);
1150 hh=(link_list)hh->next;
1151 }
1152 ssiToBeClosed_inactive=FALSE;
1153
1154 idhdl h = currPack->idroot;
1155 while(h != NULL)
1156 {
1157 if(IDTYP(h) == LINK_CMD)

Callers 15

scanner.ccFile · 0.85
sig_term_hdlFunction · 0.85
sigint_handlerFunction · 0.85
stack_traceFunction · 0.85
cntrlc.ccFile · 0.85
sdbFunction · 0.85
omSingOutOfMemoryFuncFunction · 0.85
mainFunction · 0.85
sipc_semaphore_acquireFunction · 0.85
sipc_semaphore_releaseFunction · 0.85
ssiOpenFunction · 0.85

Calls 5

monitorFunction · 0.85
fe_reset_input_modeFunction · 0.85
slPrepCloseFunction · 0.85
killhdlFunction · 0.85
slCloseFunction · 0.85

Tested by 1

mainFunction · 0.68