Barr Group TwitterBarr Group Vimeo

Rules:

6.4.a. All functions that encapsulate threads of execution (a.k.a., tasks, processes) shall be given names ending with “_thread” (or “_task”, “_process”).

Example:

void
alarm_thread (void * p_data)
{
    alarm_t  alarm = ALARM_NONE;
    int	     err   = OS_NO_ERR;

    for (;;)
    {
        alarm = OSMboxPend(alarm_mbox, &err);
        // Process alarm here.
    }
}

Reasoning: Each task in a real-time operating system (RTOS) is like a mini-main(), typically running forever in an infinite loop. It is valuable to easily identify these important, asynchronous functions during code reviews and debugging sessions.

Enforcement: This rule shall be followed during the detailed design phase and enforced during code reviews.

What’s happening and how it’s done. Get in the know.

Sign Up for Our Newsletter

Receive free how-to articles, industry news, and the latest info on Barr Group webinars and training courses via email. 

To prevent automated spam submissions leave this field empty.