// This file is part of the SV-Benchmarks collection of verification tasks: // https://gitlab.com/sosy-lab/benchmarking/sv-benchmarks // // SPDX-FileCopyrightText: 2005-2021 University of Tartu & Technische Universität München // // SPDX-License-Identifier: MIT #include int data[10]; pthread_mutex_t m[10]; void *t_fun(void *arg) { pthread_mutex_lock(&m[4]); data[4]++; // RACE! pthread_mutex_unlock(&m[4]); return NULL; } int main() { for (int i = 0; i < 10; i++) pthread_mutex_init(&m[i], NULL); pthread_t id; pthread_create(&id, NULL, t_fun, NULL); pthread_mutex_lock(&m[3]); data[4]++; // RACE! pthread_mutex_unlock(&m[3]); return 0; }