Stability issues in C++

John Ford jford at nrao.edu
Mon Jun 5 14:19:34 CEST 2006


Ibrahim writes:
 > Hi, 
 >  
 >  actually i'm developping an application using C++ and i encounter
 >  many problem for its execution in a realtime context! As you have
 >  an experience in C++ programming, i want to benefit from it to ask
 >  you for some questions:
 >  
 >  - how do u use the LXRT tasks (creation, behaviour's defintion)
 >  into C++ classes? if u encapsulate tasks in posix thread or in C++
 >  user defined classes?

We do not get that fancy.  All the process control, task creation,
etc. we do in our main task routines.  We use C++ to encapsulate our
data and abstract the meat of the application so that the main loop of the
task might be just like:

task1( void * ptr_to_object )
{
   (MyObject) ptr_to_object->run()

}

 >  - how do u manage dynamic memory allocation (primitive new) into LXRT context??

I don't do dynamuic memory allocation in a realtime system, with the exception of in the
initial object creation and initializations.  You do have to be careful
about what C++ is doing under the surface.

Hope this helps.

John





More information about the Rtai mailing list