AnsweredAssumed Answered

critical question

Question asked by li.lou on Apr 20, 2015
Latest reply on Apr 24, 2015 by bryson.paul
hello, I define the critical like this:
*********************************************
    #define define_critical()           uint8 cpu_sr
    #define enter_critical()            cpu_sr=EnterCritical()
    #define exit_critical()             ExitCritical(cpu_sr)
    uint8 EnterCritical(void)
   {
        #asm
        push cc
        sim
        pop a
        #endasm
    }

    void ExitCritical(uint8 sr)
    {
        #asm
        push a
        pop cc
        #endasm
    }
*******************************
I use the critical like this:
Templet fun(Templet)
{
    define_critical();
    enter_critical();
    // do something
    exit_critical();
}
But I think that, there are some hidden problems! so, what it will happen?

Outcomes