- #include <stdio.h>
- #include <assert.h>
- #include <unistd.h>
- #include <pthread.h>
- volatile int foo;
- static void *loopy(void *arg)
- {
- volatile int foo2;
- for (long i = 0; i < 125000000; i++)
- {
- foo++;
- for (int k = 0; k < 4; k++)
- foo2++;
- }
- printf("done\n");
- return 0;
- }
- int main(void)
- {
- pthread_t th;
- for (int j = 0; j < 2; j++)
- pthread_create(&th, NULL, loopy, NULL);
- sleep(999);
- }