space_multi_thread_balance_length.cpp File Reference
#include "space_multi_thread_balance_length.h"
#include <argos3/core/simulator/simulator.h>
#include <argos3/core/utility/profiler/profiler.h>
Include dependency graph for space_multi_thread_balance_length.cpp:

Go to the source code of this file.

Classes

struct  argos::SCleanupThreadData
 

Namespaces

 argos
 The namespace containing all the ARGoS related code.
 

Macros

#define MAIN_START_PHASE(PHASE)
 
#define MAIN_WAIT_FOR_END_OF(PHASE)
 
#define THREAD_WAIT_FOR_START_OF(PHASE)
 
#define THREAD_PERFORM_TASK(PHASE, TASKVEC, SNIPPET)
 

Functions

void * argos::LaunchThreadBalanceLength (void *p_data)
 

Macro Definition Documentation

◆ MAIN_START_PHASE

#define MAIN_START_PHASE (   PHASE)
Value:
pthread_mutex_lock(&m_tStart ## PHASE ## PhaseMutex); \
m_un ## PHASE ## PhaseIdleCounter = 0; \
m_unTaskIndex = 0; \
pthread_cond_broadcast(&m_tStart ## PHASE ## PhaseCond); \
pthread_mutex_unlock(&m_tStart ## PHASE ## PhaseMutex);

Definition at line 156 of file space_multi_thread_balance_length.cpp.

◆ MAIN_WAIT_FOR_END_OF

#define MAIN_WAIT_FOR_END_OF (   PHASE)
Value:
pthread_mutex_lock(&m_tStart ## PHASE ## PhaseMutex); \
while(m_un ## PHASE ## PhaseIdleCounter < CSimulator::GetInstance().GetNumThreads()) { \
pthread_cond_wait(&m_tStart ## PHASE ## PhaseCond, &m_tStart ## PHASE ## PhaseMutex); \
} \
pthread_mutex_unlock(&m_tStart ## PHASE ## PhaseMutex);

Definition at line 163 of file space_multi_thread_balance_length.cpp.

◆ THREAD_PERFORM_TASK

#define THREAD_PERFORM_TASK (   PHASE,
  TASKVEC,
  SNIPPET 
)
Value:
while(1) { \
pthread_mutex_lock(&m_tFetchTaskMutex); \
if(m_unTaskIndex < (TASKVEC).size()) { \
unTaskIndex = m_unTaskIndex; \
++m_unTaskIndex; \
pthread_mutex_unlock(&m_tFetchTaskMutex); \
pthread_testcancel(); \
{ \
SNIPPET; \
} \
pthread_testcancel(); \
} \
else { \
pthread_mutex_unlock(&m_tFetchTaskMutex); \
pthread_testcancel(); \
pthread_mutex_lock(&m_tStart ## PHASE ## PhaseMutex); \
++m_un ## PHASE ## PhaseIdleCounter; \
pthread_cond_broadcast(&m_tStart ## PHASE ## PhaseCond); \
pthread_mutex_unlock(&m_tStart ## PHASE ## PhaseMutex); \
pthread_testcancel(); \
break; \
} \
} \
pthread_testcancel();

Definition at line 241 of file space_multi_thread_balance_length.cpp.

◆ THREAD_WAIT_FOR_START_OF

#define THREAD_WAIT_FOR_START_OF (   PHASE)
Value:
pthread_mutex_lock(&m_tStart ## PHASE ## PhaseMutex); \
while(m_un ## PHASE ## PhaseIdleCounter == CSimulator::GetInstance().GetNumThreads()) { \
pthread_cond_wait(&m_tStart ## PHASE ## PhaseCond, &m_tStart ## PHASE ## PhaseMutex); \
} \
pthread_mutex_unlock(&m_tStart ## PHASE ## PhaseMutex); \
pthread_testcancel();

Definition at line 233 of file space_multi_thread_balance_length.cpp.