| | 1263 | | assign_tasks(wp) |
| | 1264 | | struct waitc *wp; |
| | 1265 | | { |
| | 1266 | | static int lasthh = -1; |
| | 1267 | | |
| | 1268 | | struct waitc_spawn *wxp = (struct waitc_spawn*)wp->wa_spec; |
| | 1269 | | struct htab *htp; |
| | 1270 | | int *vec; |
| | 1271 | | int veclen; |
| | 1272 | | int count = 0; |
| | 1273 | | int nh; |
| | 1274 | | int a = 0; |
| | 1275 | | int na = 0; |
| | 1276 | | struct waitc *wp2; |
| | 1277 | | struct hostd *hp; |
| | 1278 | | struct pmsg *mp; |
| | 1279 | | int t; |
| | 1280 | | int i; |
| | 1281 | | int tid; |
| | 1282 | | struct timeval now; |
| | 1283 | | |
| | 1284 | | if (!wxp) |
| | 1285 | | return 0; |
| | 1286 | | |
| | 1287 | | htp = wxp->w_ht; |
| | 1288 | | vec = wxp->w_vec; |
| | 1289 | | veclen = wxp->w_veclen; |
| | 1290 | | |
| | 1291 | | |
| | 1292 | | |
| | 1293 | | |
| | 1294 | | |
| | 1295 | | if (!htp->ht_cnt) |
| | 1296 | | for (t = veclen; t-- > 0; ) |
| | 1297 | | if (!vec[t]) |
| | 1298 | | vec[t] = PvmNoHost;
|
| | 1299 | | |
| | 1300 | | |
| | 1301 | | |
| | 1302 | | |
| | 1303 | | |
| | 1304 | | for (t = veclen; t-- > 0; ) |
| | 1305 | | if (!vec[t]) |
| | 1306 | | count++; |
| | 1307 | | |
| | 1308 | | if (!count) { |
| | 1309 | | pkint(wp->wa_mesg, wxp->w_veclen); |
| | 1310 | | for (t = 0; t < wxp->w_veclen; t++) { |
| | 1311 | | tid = wxp->w_vec[t]; |
| | 1312 | | pkint(wp->wa_mesg, tid); |
| | 1313 | | if (TIDISTASK(tid) && wxp->w_trctid > 0) {
|
| | 1314 | | tev_send_spntask( |
| | 1315 | | wxp->w_trctid, wxp->w_trcctx, wxp->w_trctag, |
| | 1316 | | tid, wxp->w_ptid ); |
| | 1317 | | } |
| | 1318 | | if (TIDISTASK(tid) && wxp->w_outtid > 0) {
|
| | | | ... |
| | 1331 | | |
| | 1332 | | free_wait_spawn(wxp); |
| | 1333 | | wp->wa_spec = 0; |
| | 1334 | | return 0; |
| | 1335 | | } |
| | 1336 | | |
| | 1337 | | |
| | 1338 | | |
| | 1339 | | |
| | 1340 | | |
| | 1341 | | nh = min(htp->ht_cnt, count);
|
| | 1342 | | |
| | 1343 | | |
| | 1344 | | |
| | 1345 | | if (lasthh == -1) |
| | 1346 | | lasthh = hosts->ht_local + 1; |
| | 1347 | | if (lasthh > htp->ht_last) |
| | 1348 | | lasthh = 0; |
| | 1349 | | while (!htp->ht_hosts[lasthh]) |
| | 1350 | | if (++lasthh > htp->ht_last) |
| | 1351 | | lasthh = 1; |
| | 1352 | | hp = htp->ht_hosts[lasthh]; |
| | 1353 | | |
| | 1354 | | for (t = 0; t < veclen && vec[t]; t++); |
| | 1355 | | |
| | 1356 | | while (t < veclen) { |
| | 1357 | | |
| | 1358 | | |
| | 1359 | | |
| | 1360 | | |
| | 1361 | | vec[t] = hp->hd_hostpart; |
| | 1362 | | na++; |
| | 1363 | | |
| | 1364 | | |
| | 1365 | | |
| | 1366 | | if ((a += nh) >= count) { |
| | 1367 | | a -= count; |
| | 1368 | | |
| | 1369 | | wp2 = wait_new(WT_SPAWN);
|
| | 1370 | | wp2->wa_tid = wp->wa_tid; |
| | 1371 | | wp2->wa_on = hp->hd_hostpart; |
| | 1372 | | wp2->wa_spec = wp->wa_spec; |
| | 1373 | | wp->wa_mesg->m_ref++; |
| | 1374 | | wp2->wa_mesg = wp->wa_mesg; |
| | 1375 | | LISTPUTBEFORE(wp, wp2, wa_peer, wa_rpeer);
|
| | 1376 | | |