src/thrille-core/threadtracker.cpp
/*
 * handle reuse is implemented by simply finding the 
 * highest TID that matches.  This is reasonable
 * because the if there is more than one match,
 * it means that another thread must have been 
 * spawned with the same handle.
 */
handle reuse is implemented by simply finding the
highest TID that matches.  This is reasonable
because the if there is more than one match,
it means that another thread must have been
spawned with the same handle.
handle reuse is implemented by simply finding the highest TID that matches . This is reasonable because the if there is more than one match it means that another thread must have been spawned with the same handle .
thrID ThreadTracker::translateHandleToTID(pthread_t id) {
    Originals::pthread_mutex_lock(&threadtracker_mutex);
    map<thrID, pthread_t>::iterator itr;
    thrID result = -1;
    for (itr = pthreadHandleMap.begin(); 
            itr != pthreadHandleMap.end(); 
            itr++) {
        pthread_t tmp = itr->second;
        if (Originals::pthread_equal(tmp, id)) {
            result = max(itr->first, result);
        }
    }
    Originals::pthread_mutex_unlock(&threadtracker_mutex);
    if (result == -1) {
        printf("ThreadTracker: ERROR: could not find TID -> handle map\n");
        _Exit(UNRECOVERABLE_ERROR);
    }
    return result;
}
thrID ThreadTracker :: translateHandleToTID ( pthread_t id ) { Originals :: pthread_mutex_lock ( & threadtracker_mutex ) ; map < thrID , pthread_t > :: iterator itr ; thrID result = -1 ; for ( itr = pthreadHandleMap . begin ( ) ; itr != pthreadHandleMap . end ( ) ; itr ++ ) { pthread_t tmp = itr -> second ; if ( Originals :: pthread_equal ( tmp , id ) ) { result = max ( itr -> first , result ) ; } } Originals :: pthread_mutex_unlock ( & threadtracker_mutex ) ; if ( result == -1 ) { printf ( " \n " ) ; _Exit ( UNRECOVERABLE_ERROR ) ; } return result ; }
handle reuse is implemented by simply finding the
 highest TID that matches.
handle reuse is implemented by simply finding the highest TID that matches .
//Originals::usleep(100); //printf("Threadtracker: tmp: %lu, id: %lu\n", tmp, id);