Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the term "interrupt safe" mean?

I come across this term every now and then. And now I really need a clear explanation as I wish to use some MPI routines that are said not to be interrupt-safe.

like image 600
cpp_noname Avatar asked Jun 30 '11 13:06

cpp_noname


People also ask

What does interrupt safe mean?

The "Interrupt Safe Mode" configuration is a special setting designed to handle bad PXE implementations that do not comply with PXE standards or have bugs. The setting forces a reset on the UNDI Interface after sending every packet into the Network.

Are interrupts thread safe?

LVGL is not thread-safe by default.


2 Answers

I believe it's another wording for reentrant. If a function is reentrant it can be interrupted in the middle and called again.

For example:

void function()
{
    lock(mtx);
    /* code ... */
    unlock(mtx);
}

This function can clearly be called by different threads (the mutex will protect the code inside). But if a signal arrives after lock(mtx) and the function is called again it will deadlock. So it's not interrupt-safe.

like image 188
cnicutar Avatar answered Oct 06 '22 09:10

cnicutar


Code that is safe from concurrent access from an interrupt is said to be interrupt-safe.

Consider a situation that your process is in critical section and an asynchronous event comes and interrupts your process to access the same shared resource that process was accessing before preemption.

It is a major bug if an interrupt occurs in the middle of code that is manipulating a resource and the interrupt handler can access the same resource. Locking can save you!

like image 36
zafarulq Avatar answered Oct 06 '22 09:10

zafarulq