IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33478


Ignore:
Timestamp:
Mar 11, 2012, 2:53:37 PM (14 years ago)
Author:
eugene
Message:

flush I/O buffers; do not test STDIN for data req

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/HostTable.c

    r33475 r33478  
    234234    timeout.tv_usec = 500000;
    235235
    236     int status = select (Nmax, &rdSet, &wtSet, NULL, &timeout);
     236    int status = select (Nmax, NULL, &wtSet, NULL, &timeout);
    237237    if (status == -1) {
    238238      perror("select()");
     
    251251        // this host has waiting output : read to buffer, and dump if necessary
    252252        ReadtoIOBuffer (&table->hosts[i].stdout, table->hosts[i].stdio[HOST_STDOUT]);
    253         if (table->hosts[i].stdout.Nbuffer > 0x10000) {
     253        // if (table->hosts[i].stdout.Nbuffer > 0x10000) {
     254        if (table->hosts[i].stdout.Nbuffer > 0x1000) {
    254255          fprintf (stdout, "--- stdout from %s ---\n", table->hosts[i].hostname);
    255256          write (STDOUT_FILENO, table->hosts[i].stdout.buffer, table->hosts[i].stdout.Nbuffer);
     257          FlushIOBuffer (&table->hosts[i].stdout);
    256258          fprintf (stdout, "\n");
    257259        }
     
    261263        // this host has waiting output : read to buffer, and dump if necessary
    262264        ReadtoIOBuffer (&table->hosts[i].stderr, table->hosts[i].stdio[HOST_STDERR]);
    263         if (table->hosts[i].stderr.Nbuffer > 0x10000) {
     265        // if (table->hosts[i].stderr.Nbuffer > 0x10000) {
     266        if (table->hosts[i].stderr.Nbuffer > 0x1000) {
    264267          fprintf (stdout, "--- stderr from %s ---\n", table->hosts[i].hostname);
    265268          write (STDOUT_FILENO, table->hosts[i].stderr.buffer, table->hosts[i].stderr.Nbuffer);
     269          FlushIOBuffer (&table->hosts[i].stderr);
    266270          fprintf (stdout, "\n");
    267271        }
     
    274278      int pid = waitpid (-1, &status, WNOHANG);
    275279      if (!pid) {
     280        // fprintf (stderr, "no hosts to harvest\n");
     281        usleep (500000);
    276282        break; // no outstanding jobs have finished
    277         fprintf (stderr, "no hosts to harvest\n");
    278         usleep (500000);
    279283      }
    280284      if ((pid == -1) && (errno == ECHILD)) goto escape; // no more jobs on which to wait
     
    298302        fprintf (stdout, "--- stdout from %s ---\n", table->hosts[j].hostname);
    299303        write (STDOUT_FILENO, table->hosts[j].stdout.buffer, table->hosts[j].stdout.Nbuffer);
     304        FlushIOBuffer (&table->hosts[i].stdout);
    300305        fprintf (stdout, "\n");
    301306           
     
    304309        fprintf (stdout, "--- stderr from %s ---\n", table->hosts[j].hostname);
    305310        write (STDOUT_FILENO, table->hosts[j].stderr.buffer, table->hosts[j].stderr.Nbuffer);
     311        FlushIOBuffer (&table->hosts[i].stderr);
    306312        fprintf (stdout, "\n");
    307313
Note: See TracChangeset for help on using the changeset viewer.