Skip to content

Breaks inside RB_ATOMIC code block #13

@slaff

Description

@slaff

The current RB_ATOMIC_* definitions for ESP8266 look like this

#define RB_ATOMIC_START do { uint32_t _savedIS = xt_rsil(15) ;
#define RB_ATOMIC_END xt_wsr_ps(_savedIS); } while(0);

If I have a code like this one:

do {

RB_ATOMIC_START 
{
     // .. do something
     if(condition) {
                break;
     }
     // .. do something
}
RB_ATOMIC_END

}
while(0)

The break inside the RB_ATOMIC code will be "silenced" and the code will misbehave. Isn't it better to have a definition without do { and } while(9) ?

Related to NicoHood/IRLremote#20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions