Changeset 1134

Show
Ignore:
Timestamp:
07/13/10 17:37:59 (14 years ago)
Author:
prikryl
Message:

Remember the process handle of the Aimsun process.
Use the class destructor to terminate Aimsun and the waiting controllers.

Location:
applications/doprava/aimsun_bdm
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • applications/doprava/aimsun_bdm/aimsun_ds.cpp

    r1123 r1134  
    135135} 
    136136 
     137AimsunDS::~AimsunDS ( void ) 
     138{ 
     139        /* Stop Aimsun. */ 
     140        BOOL res = TerminateProcess ( (HANDLE)hPid, 0 ); 
     141        if ( ! res ) 
     142        { 
     143                fprintf ( stderr, "Cannot terminate Aimsun, error code %d!\n", GetLastError() ); 
     144        } 
     145 
     146        /* Controllers are most likely waiting for another input 
     147           so unblock them - their message loop will receive the 
     148           "Aimsun exited" message right away. */ 
     149        eh_wakeup_controllers (); 
     150} 
     151 
    137152void AimsunDS::from_setting ( const Setting &cfg ) 
    138153{ 
     
    179194        DWORD dwBufLen = MAX_PATH_BYTES; 
    180195        LONG  res; 
    181  
    182         intptr_t hPid; 
    183196 
    184197        int verIndex = 1; //@TODO@: 0 is for release, 1 for debug build of the DLL libraries. 
  • applications/doprava/aimsun_bdm/aimsun_ds.h

    r1089 r1134  
    3535    AimsunDS (); 
    3636 
     37        //! Destructor 
     38        ~AimsunDS (); 
     39 
    3740    //! Get measurements and signal plans from ELS3 controllers 
    3841    void getdata ( vec &dt ) const; 
     
    5558    // TODO dodelat void to_setting( Setting &root ) const; 
    5659private: 
     60        //! Handle of the Aimsun process. Used to terminate Aimsun after simulation. 
     61        intptr_t hPid; 
     62         
    5763        //! File name containing vehicle entrances into the network 
    5864        string entranceFileName;