I have a c program basically is running in infinite While loop as shown below.
int main(int argc, char** argv )
{    
     Detectdirection *d;
     //Mosquitto
     io_service io;
     deadline_timer t(io);
     MosquitoInterface *m = new MosquitoInterface(t);
     d = new Detectdirection();      
     while(true)
     {        
        int ret =  d->Tracking();
        if(ret < 0)
           cout << "Pattern is not found" << endl ;
     }  
     delete d;
     delete m;
     cout << "Exit" << endl;
     return 0;
}
I like to run and stop the program from python script. Running the program is quite straightforward. Just to provide a path to the build file as discussed here.
But how can I stop the application from Pyhton so that those objects created are deleted properly.
 
     
     
     
    