1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#include <stdio.h> volatile unsigned int c=0xbeef; int inc(int i) { i++; if(i==0)i=1; return i; } int main() { int thread=_clone(); if(thread!=0) // thread 1 { while(1) { c++; } } else // thread2 { while(1) printf("0x%08x\n",c); } }