Changeset 1edbcdd in git
- Timestamp:
- Mar 11, 2011, 1:38:26 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 240d6e0f71a7c78b7ad7e858be185c519c48c85f
- Parents:
- 2404eaa111daafc0bf19376132cb7a10c7f21daf
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/iparith.cc
r2404eaa r1edbcdd 3203 3203 // or 0 for polling 3204 3204 // returns: ERROR (via Werror): timeout negative 3205 // 0: timeout (or polling): none ready 3205 // -1: the read state of all links is eof 3206 // 0: timeout (or polling): none ready 3206 3207 // i>0: (at least) L[i] is ready 3207 3208 lists Lforks = (lists)u->Data(); … … 3212 3213 } 3213 3214 int i = slStatusSsiL(Lforks, t*1000); 3215 if(i == -2) /* error */ 3216 { 3217 return TRUE; 3218 } 3214 3219 res->data = (void*)(long)i; 3215 3220 return FALSE; … … 3222 3227 // or 0 for polling 3223 3228 // returns: ERROR (via Werror): timeout negative 3229 // -1: the read state of all links is eof 3224 3230 // 0: timeout (or polling): none ready 3225 3231 // 1: all links are ready 3232 // (caution: at least one is ready, but some maybe dead) 3226 3233 lists Lforks = (lists)u->CopyD(); 3227 3234 int timeout = 1000*(int)(long)v->Data(); … … 3232 3239 int t = 1000*getRTimer()/TIMER_RESOLUTION; 3233 3240 int i; 3234 int ret = 1;3235 for(int nfinished = 0; nfinished < Lforks->nr ; nfinished++)3241 int ret = -1; 3242 for(int nfinished = 0; nfinished < Lforks->nr+1; nfinished++) 3236 3243 { 3237 3244 i = slStatusSsiL(Lforks, timeout); 3238 if(i > 0) 3239 { 3245 if(i > 0) /* Lforks[i] is ready */ 3246 { 3247 ret = 1; 3240 3248 Lforks->m[i-1].CleanUp(); 3241 3249 Lforks->m[i-1].rtyp=DEF_CMD; … … 3243 3251 timeout = si_max(0,timeout - 1000*getRTimer()/TIMER_RESOLUTION + t); 3244 3252 } 3245 else { ret = 0; break; /* terminate the for loop */ } 3253 else /* terminate the for loop */ 3254 { 3255 if(i == -2) /* error */ 3256 { 3257 return TRUE; 3258 } 3259 if(i == 0) /* timeout */ 3260 { 3261 ret = 0; 3262 } 3263 break; 3264 } 3246 3265 } 3247 3266 Lforks->Clean(); … … 4618 4637 // input: u: a list with links of type 4619 4638 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch 4620 // returns: i>0: (at least) a[i] is ready 4639 // returns: -1: the read state of all links is eof 4640 // i>0: (at least) u[i] is ready 4621 4641 lists Lforks = (lists)u->Data(); 4622 4642 int i = slStatusSsiL(Lforks, -1); 4643 if(i == -2) /* error */ 4644 { 4645 return TRUE; 4646 } 4623 4647 res->data = (void*)(long)i; 4624 4648 return FALSE; … … 4628 4652 // input: u: a list with links of type 4629 4653 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch 4630 // returns: nothing. All links are ready when finished. 4654 // returns: -1: the read state of all links is eof 4655 // 1: all links are ready 4656 // (caution: at least one is ready, but some maybe dead) 4631 4657 lists Lforks = (lists)u->CopyD(); 4632 4658 int i; 4633 for(int nfinished = 0; nfinished < Lforks->nr; nfinished++) 4659 int j = -1; 4660 for(int nfinished = 0; nfinished < Lforks->nr+1; nfinished++) 4634 4661 { 4635 4662 i = slStatusSsiL(Lforks, -1); 4663 if(i == -2) /* error */ 4664 { 4665 return TRUE; 4666 } 4667 if(i == -1) 4668 { 4669 break; 4670 } 4671 j = 1; 4636 4672 Lforks->m[i-1].CleanUp(); 4637 4673 Lforks->m[i-1].rtyp=DEF_CMD; 4638 4674 Lforks->m[i-1].data=NULL; 4639 4675 } 4676 res->data = (void*)(long)j; 4640 4677 Lforks->Clean(); 4641 4678 return FALSE; -
Singular/misc_ip.cc
r2404eaa r1edbcdd 1059 1059 else 1060 1060 { 1061 printf("\nhalt %d\n",i); 1061 if(!singular_in_batchmode) 1062 { 1063 printf("\nhalt %d\n",i); 1064 } 1062 1065 } 1063 1066 #ifdef HAVE_MPSR -
Singular/ssiLink.cc
r2404eaa r1edbcdd 1197 1197 { 1198 1198 // input: L: a list with links of type 1199 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch 1199 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch. 1200 // Note: Not every entry in L must be set. 1200 1201 // timeout: timeout for select in micro-seconds 1201 1202 // or -1 for infinity … … 1203 1204 // returns: ERROR (via Werror): L has wrong elements or link not open 1204 1205 // -2: select returns an error 1205 // 0: timeout or (polling): none ready 1206 // -1: the read state of all links is eof 1207 // 0: timeout (or polling): none ready, 1206 1208 // i>0: (at least) L[i] is ready 1207 1209 si_link l; … … 1212 1214 int d_fd; 1213 1215 fd_set mask, fdmask; 1216 FD_ZERO(&fdmask); 1214 1217 FD_ZERO(&mask); 1215 int max_fd=0; /* max fd in fd_set */ 1216 struct timeval wt; 1218 int max_fd=0; /* 1 + max fd in fd_set */ 1219 1220 /* timeout */ 1221 struct timespec wt; 1222 int startingtime = getRTimer()/TIMER_RESOLUTION; // in seconds 1223 struct timespec *wt_ptr=&wt; 1224 if (timeout== -1) 1225 { 1226 wt_ptr=NULL; 1227 } 1228 else 1229 { 1230 wt.tv_sec = timeout / 1000000; 1231 wt.tv_nsec = 1000 * (timeout % 1000000); 1232 } 1233 1234 /* signal mask for pselect() */ 1235 sigset_t sigmask; 1236 if(sigprocmask(SIG_SETMASK, NULL, &sigmask) < 0) 1237 { 1238 WerrorS("error in sigprocmask()"); 1239 return -2; 1240 } 1241 if(sigaddset(&sigmask, SIGCHLD) < 0) 1242 { 1243 WerrorS("error in sigaddset()"); 1244 return -2; 1245 } 1246 1247 /* auxiliary variables */ 1217 1248 int i; 1249 int j; 1250 int k; 1251 int s; 1252 char fdmaskempty; 1253 1254 /* check the links and fill in fdmask */ 1218 1255 for(i=L->nr; i>=0; i--) 1219 1256 { … … 1229 1266 && (strcmp(l->mode,"launch")!=0))) 1230 1267 { 1231 WerrorS("all links must be of type ssi:fork, ssi:tcp, MPtcp:fork or MPtcp:launch"); 1268 WerrorS("all links must be of type ssi:fork, ssi:tcp, MPtcp:fork\n"); 1269 WerrorS("or MPtcp:launch"); 1232 1270 return -2; 1233 1271 } … … 1247 1285 d_fd=d->fd_read; 1248 1286 #endif 1249 FD_SET(d_fd, & mask);1287 FD_SET(d_fd, &fdmask); 1250 1288 if (d_fd > max_fd) max_fd=d_fd; 1251 1289 } 1252 1290 } 1253 1291 max_fd++; 1254 struct timeval *wt_ptr=&wt; 1255 if (timeout== -1) 1256 { 1257 wt_ptr=NULL; 1258 } 1259 else 1260 { 1261 wt.tv_sec = timeout / 1000000; 1262 wt.tv_usec = timeout % 1000000; 1263 } 1292 1293 do_select: 1294 /* copy fdmask to mask */ 1295 FD_ZERO(&mask); 1296 for(k = 0; k < max_fd; k++) 1297 { 1298 if(FD_ISSET(k, &fdmask)) 1299 { 1300 FD_SET(k, &mask); 1301 } 1302 } 1303 1264 1304 /* check with select: chars waiting: no -> not ready */ 1265 int s= select(max_fd, &mask, NULL, NULL, wt_ptr); 1305 s = pselect(max_fd, &mask, NULL, NULL, wt_ptr, &sigmask); 1306 Print("\nselect: %d\n", s); 1266 1307 if (s==-1) 1267 1308 { … … 1269 1310 return -2; /*error*/ 1270 1311 } 1271 int j;1272 int retry_needed=0;1273 find_next_fd:1274 1312 if (s==0) 1275 1313 { 1276 if (retry_needed) 1277 { 1278 // the os reported that one of the (ssi) links is ready, 1279 // but it was only white space: this cannot happen again: 1280 return slStatusSsiL(L,timeout); 1281 } 1282 else 1283 return 0; /*poll: not ready */ 1314 return 0; /*poll: not ready */ 1284 1315 } 1285 1316 else /* s>0, at least one ready (the number of fd which are ready is s)*/ … … 1322 1353 int c=fgetc(d->f_read); 1323 1354 //Print("try c=%d\n",c); 1324 if (c== -1) /* eof or error*/ 1325 { 1326 retry_needed=1; 1327 FD_CLR(j,&mask); 1328 s--; 1329 goto find_next_fd; 1330 } 1355 if (c== -1) /* eof */ 1356 { 1357 FD_CLR(j,&fdmask); 1358 fdmaskempty = 1; 1359 for(k = 0; k < max_fd; k++) 1360 { 1361 if(FD_ISSET(k, &fdmask)) 1362 { 1363 fdmaskempty = 0; 1364 break; 1365 } 1366 } 1367 if(fdmaskempty) 1368 { 1369 return -1; 1370 } 1371 if(timeout != -1) 1372 { 1373 timeout = si_max(0, 1374 timeout - 1000000*(getRTimer()/TIMER_RESOLUTION - startingtime)); 1375 wt.tv_sec = timeout / 1000000; 1376 wt.tv_nsec = 1000 * (timeout % 1000000); 1377 } 1378 goto do_select; 1379 } 1380 1331 1381 else if (isdigit(c)) 1332 1382 { ungetc(c,d->f_read); d->ungetc_buf='\1'; return i+1; } -
Singular/table.h
r2404eaa r1edbcdd 282 282 ,{D(loNewtonP), NEWTONPOLY_CMD, IDEAL_CMD, IDEAL_CMD , ALLOW_PLURAL |ALLOW_RING} 283 283 ,{D(jjWAIT1ST1), WAIT1ST_CMD, INT_CMD, LIST_CMD , ALLOW_PLURAL |ALLOW_RING} 284 ,{D(jjWAITALL1), WAITALL_CMD, NONE,LIST_CMD , ALLOW_PLURAL |ALLOW_RING}284 ,{D(jjWAITALL1), WAITALL_CMD, INT_CMD, LIST_CMD , ALLOW_PLURAL |ALLOW_RING} 285 285 ,{NULL, 0, 0, 0 , NO_PLURAL |NO_RING} 286 286 };
Note: See TracChangeset
for help on using the changeset viewer.