Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 488085 - Move selfsuspend and resumeSelfsuspend from CThread to CEventChainExecutionThread
Summary: Move selfsuspend and resumeSelfsuspend from CThread to CEventChainExecutionTh...
Status: CLOSED FIXED
Alias: None
Product: 4DIAC
Classification: IoT
Component: FORTE (show other bugs)
Version: 1.8 M1   Edit
Hardware: PC Linux
: P3 normal
Target Milestone: 1.9.0   Edit
Assignee: Alois Zoitl CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-19 05:13 EST by Alois Zoitl CLA
Modified: 2018-05-18 02:16 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alois Zoitl CLA 2016-02-19 05:13:18 EST
These to functions are key function for the correct functioning of the FORTE execution model for IEC 61499 FB networks. Currently these are required to be implemented in CThread. Therefore for each new operating system this has to be done.

However not all threads in FORTE need this functions. To be more specific only CEventChainExecutionThread is needing them and also demands a specific behavior. The most stable deadlock avoiding implementation is by implementing them with a counting semaphore.

Therefore the better solution would be to introduce a Semaphore abstraction class to be provided for each operating system and moving the functionality of these functions to the CEventeChainExecutionThread. This would make it easier to correctly port FORTE to new operating systems.
Comment 1 Alois Zoitl CLA 2016-03-09 13:54:07 EST
I'Ve implemetned this feature and tested in posix. Further tests are needed.
Comment 2 Jose Maria Jesus Cabral Lassalle CLA 2016-07-25 05:59:17 EDT
A problem I found was that if the CDevice is deleted without sending a stop command before, the CEventChainExecutionThread may never end. This occurs when CEventChainExecutionThread.run() is in selfSuspend, waiting for the semaphore. Because the stop command is not received, the end() function in the CEventChainExecutionThread is not called (where the resumeSuspend() is called, incrementing the semaphore). So when the destuctor of the CResource is called, it calls the destructor of the CEventChainExecutionThread which does nothing, but calls the destructor of the Thread. This setAlive to false and waits infinite for the thread to end, but since the thread is still in selfSuspend, it never ends.


Callind the end() function in the destructor of CEventChainExecutionThread would solve this issue.
Comment 3 Alois Zoitl CLA 2016-07-26 14:37:59 EDT
Normally a device it should not be possible to delete a device without that a stop command is issued. At least for all FORTE versions I know to shutdown FORTE is the sending of an KILL command via the management interface or the KILL command is issued from a OS signal (e.g., SIG_TERM). 

If you have a different way to shutdown your device I would recommend that you invoke the changeFBExecutionState(cg_nMGM_CMD_Kill); in the desctructor of your device or even better before you delete your device.
Comment 4 Alois Zoitl CLA 2018-05-18 02:16:17 EDT
As the original issue of this issue is implemented and working with 1.9.0 I close this issue for now.