Question & Answer
Question
How do you create a model to terminate an application in a normal way inside the main function using IBM Rational Rhapsody?
Cause
You must clear StartFrameworkInMainThread property to exit OXF::start() in a main function and could need to use event flag to wait for the end of another thread.
Answer
The following steps are an example that an application terminates using an event flag after waiting for the end of a reactive class, and explain how to implement using Rhapsody v7.6.1:
Note: You may review the attached sample model created by these steps as an example.
- Include OMOSEventFlag
- Create an external package oxf
- Tick CG::Package::UseAsExternal property on the General tab of the feature diagram of the package
- Create OMOSEventFlag class to refer under oxf package
- Set oxf/os.h to CG::Class::FileName property on the General tab of the feature diagram of the class
- Define EndAppEventFlag
- Create EndAppEventFlag variable under the target package
- Select OMOSEventFlag created by step 1 in Type field on the General tab of thr feature diagram
- Tick Reference checkbox
- Set OMOSFactory::instance()->createOMOSEventFlag() to Initial Value field
- Configure to wait for a signal and end an application
- Clear CG::Configuration::StartFrameworkInMainThread property
- Set EndAppEventFlag->wait(); to CG::Configuration::PostFrameworkThreadSegment property
- Set OMOS::endApplication(status); to CPP_CG::MSVC9::EndApplicationCode property
- Configure to send signal from a terminate state
Set EndAppEventFlag->signal(); to Action on entry field of a terminate state
- Configure Initial instance
![](/support/pages/system/files/support/swg/rattech.nsf/0/13d9a25524a3151785257a1400141661/Content/4.4ADC.gif)
[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Rational Rhapsody Developer","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"7.5;7.5.0.1;7.5.1;7.5.1.1;7.5.2;7.5.2.1;7.5.3;7.5.3.1;7.5.3.2;7.6;7.6.0.1;7.6.1;7.6.1.1","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg21597440