ssSetRuntimeThreadSafetyCompliance

Determine if the S-function can run multithreaded

Syntax

ssRuntimeThreadSafetyCompliance(SimStruct *S, int_T val)

Arguments

S

SimStruct representing 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 MultiThreadCoSim block property. The behavior is:

OptionMultiThreadCoSim 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++

Example

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

Introduced in R2018a