space_multi_thread_balance_length.h
Go to the documentation of this file.
1 
11 #ifndef SPACE_MULTI_THREAD_BALANCE_LENGTH_H
12 #define SPACE_MULTI_THREAD_BALANCE_LENGTH_H
13 
14 namespace argos {
15  class CSpace;
16 }
17 
18 #include <argos3/core/simulator/space/space.h>
19 
20 namespace argos {
21 
23 
24  public:
25 
28 
29  virtual void Init(TConfigurationNode& t_tree);
30  virtual void Destroy();
31 
32  virtual void Update();
33  virtual void UpdateControllableEntitiesAct();
34  virtual void UpdatePhysics();
35  virtual void UpdateMedia();
37 
38  private:
39 
40  void StartThreads();
41  void SlaveThread();
42  friend void* LaunchThreadBalanceLength(void* p_data);
43 
44  private:
45 
47  struct SThreadLaunchData {
48  UInt32 ThreadId;
50 
51  SThreadLaunchData(UInt32 un_thread_id,
53  ThreadId(un_thread_id),
54  Space(pc_space) {}
55  };
56 
58  pthread_t* m_ptThreads;
59 
61  SThreadLaunchData** m_psThreadData;
62 
64  size_t m_unTaskIndex;
65 
67  pthread_mutex_t m_tStartSenseControlPhaseMutex;
69  pthread_mutex_t m_tStartActPhaseMutex;
71  pthread_mutex_t m_tStartPhysicsPhaseMutex;
73  pthread_mutex_t m_tStartMediaPhaseMutex;
75  pthread_mutex_t m_tFetchTaskMutex;
76 
78  pthread_cond_t m_tStartSenseControlPhaseCond;
80  pthread_cond_t m_tStartActPhaseCond;
82  pthread_cond_t m_tStartPhysicsPhaseCond;
84  pthread_cond_t m_tStartMediaPhaseCond;
86  pthread_cond_t m_tFetchTaskCond;
87 
89  UInt32 m_unSenseControlPhaseIdleCounter;
91  UInt32 m_unActPhaseIdleCounter;
93  UInt32 m_unPhysicsPhaseIdleCounter;
95  UInt32 m_unMediaPhaseIdleCounter;
96 
97  };
98 
99 }
100 
101 #endif
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
unsigned int UInt32
32-bit unsigned integer.
Definition: datatypes.h:97
virtual void Init(TConfigurationNode &t_tree)
Initializes the space using the section of the XML configuration file.
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
virtual void Destroy()
Destroys the space and all its entities.