linux-sysprog · beginner · ~15 min

Classify a threading bug

Name the common concurrency bugs.

Challenge

Implement int is_concurrency_bug(const char *desc) returning 1 for "unguarded-shared-write", "double-unlock", and "join-after-detach", and 0 for "thread-local-counter".

Starter code

#include <string.h>

int is_concurrency_bug(const char *desc) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.