what is a reentrant kernel

后端 未结 4 1674
刺人心
刺人心 2021-01-31 17:54

What is a reentrant kernel?

4条回答
  •  眼角桃花
    2021-01-31 18:07

    A reentrant function is one that can be used by more than one task concurrently without fear of data corruption. Conversely, a non-reentrant function is one that cannot be shared by more than one task unless mutual exclusion to the function is ensured either by using a semaphore or by disabling interrupts during critical sections of code. A reentrant function can be interrupted at any time and resumed at a later time without loss of data. Reentrant functions either use local variables or protect their data when global variables are used.

    A reentrant function:

    Does not hold static data over successive calls
    Does not return a pointer to static data; all data is provided by the caller of the function
    Uses local data or ensures protection of global data by making a local copy of it
    Must not call any non-reentrant functions
    

提交回复
热议问题