void *CueIntegrationR::compute4(void* ptr) { CueIntegrationR *obj = reinterpret_cast<CueIntegrationR*>(ptr); unsigned int counter = 3; bool* endthreads = &(obj->m_endthreads); Cue** cues = obj->mdp_Cues; Cue* cue = cues[counter]; pthread_barrier_t* barrier = &(obj->m_barrier); pthread_cond_t* threadsstart = &(obj->m_condition_threadsstart); pthread_cond_t* threadended = &(obj->m_condition_threadsended); // pthread_mutex_t* mutex_waitlock = &((obj->mp_mutex_waitlock)[counter]); pthread_mutex_t* mutex_waitlock = &((obj->m_mutex_waitlock1)); while(!(*endthreads)) { //pthread_mutex_lock( &((obj->m_mutex_waitlock1)) ); pthread_mutex_lock( mutex_waitlock ); //if(obj->debug) std::cout << obj->getName() << "::compute2()::pause\n"; //pthread_cond_wait( &(obj->m_condition_threadsstart), &((obj->m_mutex_waitlock1)) ); //pthread_cond_wait( &(obj->m_condition_threadsstart), mutex_waitlock ); pthread_cond_wait( threadsstart, mutex_waitlock ); //if(obj->debug) std::cout << obj->getName() << "::compute2()::resume\n"; //Cue* cue = (obj->mdp_Cues)[counter]; //pthread_mutex_unlock( &((obj->m_mutex_waitlock1)) ); pthread_mutex_unlock( mutex_waitlock ); //if(obj->debug) std::cout << obj->getName() << "::compute2()::executing " << cue->getName() << "\n"; cue->execute(); int wait = pthread_barrier_wait( barrier ); //int wait = pthread_barrier_wait( &(obj->m_barrier) ); if(wait == -1) { pthread_cond_signal( threadended ); //pthread_cond_signal( &(obj->m_condition_threadsended) ); } } return NULL; }
void *CueIntegrationR::compute8(void* ptr) { unsigned int counter = 7; CueIntegrationR *obj = reinterpret_cast<CueIntegrationR*>(ptr); bool* endthreads = &(obj->m_endthreads); Cue* cue = (obj->mdp_Cues)[counter]; pthread_barrier_t* barrier = &(obj->m_barrier); pthread_cond_t* threadstart = &(obj->m_condition_threadsstart); pthread_cond_t* threadended = &(obj->m_condition_threadsended); // pthread_mutex_t* mutex_waitlock = &((obj->mp_mutex_waitlock)[counter]); pthread_mutex_t* mutex_waitlock = &((obj->m_mutex_waitlock8)); while(!(*endthreads)) { pthread_mutex_lock( mutex_waitlock ); pthread_cond_wait( threadstart, mutex_waitlock ); pthread_mutex_unlock( mutex_waitlock ); cue->execute(); int wait = pthread_barrier_wait( barrier ); if(wait == -1) { pthread_cond_signal( threadended ); } } return NULL; }