Changeset 670 for branches/devel


Ignore:
Timestamp:
Jul 3, 2007 9:01:47 AM (12 years ago)
Author:
forrest
Message:

possible thread loop?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/devel/Cbc/src/CbcModel.cpp

    r669 r670  
    22322232    bool goodTimer = time<(CoinCpuTime() - dblParam_[CbcStartSeconds]);
    22332233    for (i=0;i<numberThreads_;i++) {
    2234       pthread_cond_signal(threadInfo[i].condition2); // unlock
    22352234      while (threadInfo[i].returnCode==0) {
    2236         struct timespec moreTime;
    2237         moreTime.tv_nsec = 10000;
    2238         moreTime.tv_sec = 0;
    2239         nanosleep(&moreTime,NULL);
     2235        pthread_cond_signal(threadInfo[i].condition2); // unlock
     2236        pthread_mutex_lock(&condition_mutex);
     2237        struct timespec absTime;
     2238        clock_gettime(CLOCK_REALTIME,&absTime);
     2239        double time = absTime.tv_sec+1.0e-9*absTime.tv_nsec;
     2240        absTime.tv_nsec += 1000000; // millisecond
     2241        if (absTime.tv_nsec>=1000000000) {
     2242          absTime.tv_nsec -= 1000000000;
     2243          absTime.tv_sec++;
     2244        }
     2245        pthread_cond_timedwait(&condition_main,&condition_mutex,&absTime);
     2246        clock_gettime(CLOCK_REALTIME,&absTime);
     2247        double time2 = absTime.tv_sec+1.0e-9*absTime.tv_nsec;
     2248        timeWaiting += time2-time;
     2249        pthread_mutex_unlock(&condition_mutex);
    22402250      }
    22412251      threadModel[i]->numberThreads_=0; // say exit
     
    58575867    int i;
    58585868    for (i=0;i<numberThreads_;i++) {
    5859       pthread_cond_signal(threadInfo[i].condition2); // unlock
    58605869      while (threadInfo[i].returnCode==0) {
    5861         struct timespec moreTime;
    5862         moreTime.tv_nsec = 10000;
    5863         moreTime.tv_sec = 0;
    5864         nanosleep(&moreTime,NULL);
     5870        pthread_cond_signal(threadInfo[i].condition2); // unlock
     5871        pthread_mutex_lock(&condition_mutex);
     5872        struct timespec absTime;
     5873        clock_gettime(CLOCK_REALTIME,&absTime);
     5874        double time = absTime.tv_sec+1.0e-9*absTime.tv_nsec;
     5875        absTime.tv_nsec += 1000000; // millisecond
     5876        if (absTime.tv_nsec>=1000000000) {
     5877          absTime.tv_nsec -= 1000000000;
     5878          absTime.tv_sec++;
     5879        }
     5880        pthread_cond_timedwait(&condition_main,&condition_mutex,&absTime);
     5881        clock_gettime(CLOCK_REALTIME,&absTime);
     5882        double time2 = absTime.tv_sec+1.0e-9*absTime.tv_nsec;
     5883        timeWaiting += time2-time;
     5884        pthread_mutex_unlock(&condition_mutex);
    58655885      }
    58665886      threadModel[i]->numberThreads_=0; // say exit
Note: See TracChangeset for help on using the changeset viewer.