Main Content

ssSetRuntimeThreadSafetyCompliance

Determine if the S-function can run multithreaded

Syntax

ssSetRuntimeThreadSafetyCompliance(SimStruct *S, int_T val)

Arguments

S

SimStruct that represents an S-Function block.

val

Threadsafety compliance setting. The setting can be:

  • RUNTIME_THREAD_SAFETY_COMPLIANCE_UNKNOWN — Declare that it is not known if the S-function is threadsafe.

  • RUNTIME_THREAD_SAFETY_COMPLIANCE_TRUE — Declare the S-function as threadsafe.

  • RUNTIME_THREAD_SAFETY_COMPLIANCE_FALSE — Declare the S-function as not threadsafe.

Description

Use this macro in an S-function to set it as threadsafe, which means it can run multithreaded. This setting works with the set_param function MultithreadedSim block property. The behavior is:

OptionMultithreadedSim SettingS-Function Runs Single or Multithreaded
RUNTIME_THREAD_SAFETY_COMPLIANCE_UNKNOWN'auto'Single thread
RUNTIME_THREAD_SAFETY_COMPLIANCE_TRUE'auto'Multithread
RUNTIME_THREAD_SAFETY_COMPLIANCE_FALSE'auto'Single thread
'off'Setting is ignored and S-function block runs singlethreaded

Languages

C, C++

Examples

See the S-function used in matlabroot/toolbox/simulink/sfuntemplates/src/slexCoSimPrimeSFcn.c

Version History

Introduced in R2018a