IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41846


Ignore:
Timestamp:
Oct 17, 2021, 1:30:25 PM (5 years ago)
Author:
eugene
Message:

add thread state and entry to enble debugging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ppStack.20211015/src/ppStackThread.c

    r41841 r41846  
    1919    thread->firstScan = 0;
    2020    thread->lastScan = 0;
     21    thread->entry = -1; // this gets assigned after allocation
     22    thread->status = PPSTACK_THREAD_NEW;
    2123    return thread;
    2224}
     
    124126            readouts->data[j] = ro;
    125127        }
    126         threads->data[i] = ppStackThreadAlloc(readouts);
     128        ppStackThread *thread = ppStackThreadAlloc(readouts);
     129        thread->entry = i;
     130        threads->data[i] = thread;
    127131        psFree(readouts);               // Drop reference
    128132    }
     
    157161    while (true) {
    158162        // check for any groups which can read data
     163        // NOTE: threads->n is set (in ppStackThreadDataSetup) to be 1 more than the argument to -threads
    159164        for (int j = 0; j < threads->n; j++) {
    160165            ppStackThread *thread = threads->data[j];
     166            // fprintf (stderr, "grab thread %d, scan: %d - %d : busy: %d read: %d status: %d\n", thread->entry, thread->firstScan, thread->lastScan, thread->busy, thread->read, thread->status);
    161167            if (thread->read) {
    162168                continue;
     
    166172            thread->lastScan = stack->lastScan + rows;
    167173            stack->lastScan = thread->lastScan;
     174            thread->status = PPSTACK_THREAD_READ;
    168175
    169176            psArray *readouts = thread->readouts;
     
    172179
    173180            psTrace("ppStack", 2, "Reading data for chunk %d into group %d....\n", numChunk, j);
     181            // fprintf (stderr, "Reading data for chunk %d into group %d (thread %d, scan: %d - %d)....\n", numChunk, j, thread->entry, thread->firstScan, thread->lastScan);
    174182            for (int i = 0; i < readouts->n; i++) {
    175183                pmReadout *ro = readouts->data[i]; // Input readout
     
    177185                    continue;
    178186                }
     187
     188                // fprintf (stderr, "read data for readout %d\n", i);
    179189
    180190                // override the recorded last scan
     
    232242
    233243            thread->read = thread->busy = true;
     244            thread->status = PPSTACK_THREAD_RUN;
    234245            return thread;
    235246        }
     
    239250        for (int j = 0; j < threads->n; j++) {
    240251            ppStackThread *thread = threads->data[j];
     252            // fprintf (stderr, "test thread %d, scan: %d - %d : busy: %d, read: %d, status: %d\n", thread->entry, thread->firstScan, thread->lastScan, thread->busy, thread->read, thread->status);
     253
    241254            if (thread->busy) {
    242255                continue;
    243256            }
     257            thread->status = PPSTACK_THREAD_NEW;
    244258            thread->read = false;
    245259            wait = false;
Note: See TracChangeset for help on using the changeset viewer.