For that scenario why wouldn't you declare an inherited class "inside of mainloop"? Mike, That is exactly what I am trying to do. However, I want mainloop to inherit ClxThread. but i also need it to inherit a Poll_Invertors. The problem is Poll_Invertors also inherits a ClxThread to create its own thread. The results is i end up with only one thread even being started ie basicly dreaded diamond.
mainloop
/ \\
/ \\
/ \\
/ \\
ClxThread Poll_Invertors
\
\
\
ClxThread
The mainloop code class mainloop : public Poll_Invertors, public ClxThread { public: mainloop(); ~mainloop(); void Start(void){ CreateNewThread( ); };// Start Clx thread objecty protected: // The Setup Function the MC362X void init_mc362X(void); bool read_mc362x(void); bool read_lenze_cfg_sheet(void); bool read_independencer( void ); private: void ThreadRun( void ); // This is function that becomes the worker thread. MC362X_MOTION isacard; //Defines Motion object ClxUdp cmd_socket; // ClxUdp data_socket; // }
The Poll_Invertors Header lass LENZE_8200_MOTION : public ClxThread, protected CLX_LENZE_8200 { public: LENZE_8200_MOTION(void); ~LENZE_8200_MOTION(void); public: bool init_lenze8200( int comm_port, int baud_rate, long timeout_ms, int maxtxfailures ); bool start_lenze8200(void){ return CreateNewThread(); } //These public member functions are to set, get and control Lift axis lenze 8200 inverter // These function provide a thread safe way to access data member variables that contain // lift axis status information and perform commands. void pitch_set_address( char address ){ return SetAddress( &pitch_axis_data, address ); }; ... char pitch_get_address( void ){ return GetAddress( &pitch_axis_data ); }; private: void ThreadRun(void); // This is the thread function that polls the invertors void RunAll( void ); LNZ82_INVRT_DATA pitch_axis_data; LNZ82_INVRT_DATA roll_axis_data; LNZ82_INVRT_DATA lift_axis_data; LNZ82_INVRT_DATA counterweight_axis_data; ClxSafeQue m_sqInvertorsCmdQue; char m_iInvertorsPollState; char pitch_init(LNZ82_INVRT_DATA *axis); char roll_init(LNZ82_INVRT_DATA *axis); char lift_init(LNZ82_INVRT_DATA *axis); char counterweight_init(LNZ82_INVRT_DATA *axis);