MATLAB: Do I get an error when setting ‘canBeInvo​kedConcurr​ently’ to true

coderembeddedEmbedded Coder

I received the following error when generating code for AUTOSAR and set the 'cenBeInvokedConcurrently' to be true.
Simulink Function block 'myBlock' may not be invoked concurrently because one of the outputs of block 'myBlock/mySubBlock' is global data. This diagnostic is reported because 'canBeInvokedConcurrently' option is selected on the AUTOSAR runnable mapped to this Simulink Function. You may investigate further by deselecting that option, and examining the generated code.
Component:Simulink | Category:Block diagram error

Best Answer

The outputs are global variables because of the "Data Type Conversion" block within the "myBlock/mySubBlock" block. The "Data Type Conversion" block generates a global, and thus, the function cannot be reentrant (which is required for concurrent access).
If you want to allow for concurrency, remove the "Data Type Conversion" block and specify the output type directly within the "Out1" block:
1) Double click the "Out1" block. A dialog will appear.
2) Within the dialog, go to the Signal Attributes tab.
3) You can specify the data type in there.