What Is Reentrant Code?
Reentrant (multi-instance) code is a reusable
routine that multiple programs can invoke, interrupt, and reinvoke simultaneously. When you
want to reuse code, but associate each instance of the shared code with unique, preserved
data, use reentrant code. For example, consider this figure that shows four instances of
sensor_read. Although the function algorithm is the same in
each case, the data associated with each instance varies and is relative to the sensor
To make generated code for a model component reentrant, you configure the component such that model entry-point functions receive root-level input and output data as arguments. How you configure the component depends on the modeling style or technique that you apply.