ssSetRuntimeThreadSafetyCompliance
Determine if the S-function can run multithreaded
Syntax
ssSetRuntimeThreadSafetyCompliance(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 theset_param
functionMultithreadedSim
block property. The behavior is:
Option | MultithreadedSim Setting |
S-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 |
语言
C, C++
Example
See the S-function used inmatlabroot
/toolbox/simulink/simdemos/simfeatures/src/slexCoSimPrimeSFcn.c