|Home > Generic function call interface > Threading model and ordering > Reentrancy|
irisHandleMessage() implementations must support reentrancy. It can be called, and therefore reentered, by any number of pair-wise different host threads at the same time.
irisHandleMessage()can be called, and therefore reentered, by its own thread. The
irisHandleMessage()implementation must support reentrancy by the same thread and must hold mutexes only for short periods, when recursive reentrancy cannot happen, for example only when modifying local data structures and not when forwarding calls, to avoid deadlocks.
ec_FOO()callbacks, is allowed. Reading state, for example, using
memory_read()is allowed, but the results are random because the model state is fluctuating. It would not be possible to retrieve a consistent state across two or more Iris function calls. By the time a client receives an asynchronous
ec_FOO()callback, the model might have progressed, and any observed state is unlikely to be related to the event. A typical use case is to indicate progress to the user by reading and displaying an instruction count.
Calling back the simulation from within synchronous
ec_FOO() callbacks is much
more restricted than calling back from asynchronous
ec_FOO() callbacks because Iris calls cannot be
scheduled, but must complete while the simulation is blocked in the instance
generating the event. This should only be done in very specific
circumstances. The documentation of the Events API describes what
functionality can be expected from within synchronous
ec_FOO() callbacks. Also, not all event sources support
Calling back into the simulation from within a synchronous
ec_FOO() callback of instance
the following implications:
Aand all related instances might be inconsistent, depending on the nature of the event.
ec_FOO()callback should not try to read fault registers, or registers and memory that are related to the current transaction. Instead, it should interpret the fields transported with the event and it can read unrelated state, for example the PC registers of all cores.