1
0
mirror of https://github.com/ioacademy-jikim/debugging synced 2025-06-08 08:26:14 +00:00
2015-12-13 22:34:58 +09:00

36 lines
471 B
C

/* A simple race - test symaddr */
#include <pthread.h>
#include <unistd.h>
struct foo {
struct bar {
int plop[22];
char biff;
} poot[11];
};
static void *th(void *v)
{
struct foo *f = (struct foo *)v;
f->poot[5].plop[11]++;
return 0;
}
int main()
{
struct foo foo;
pthread_t a, b;
pthread_create(&a, NULL, th, &foo);
sleep(1); /* force ordering */
pthread_create(&b, NULL, th, &foo);
pthread_join(a, NULL);
pthread_join(b, NULL);
return 0;
}