|
#include#include
#include#include#include#includestaticintstop_thread=0;intsleep_in_second(intn){structtimespectime_to_sleep,time_real_sleep;time_to_sleep.tv_sec=n;time_to_sleep.tv_nsec=0;nanosleep(&time_to_sleep,&time_real_sleep);}staticvoid*thread_func(void*arg){inttemp=(int)((longlong)arg);printf("thread%d\n",temp);if(temp==1){//thread1//localvariablesmemorytestconstintlocal_size=4*1024*1024;charbuf[local_size];memset(buf,0,local_size);//mallocmemorytestconstintmalloc_size(8*1024*1024);char*p=(char*)malloc(malloc_size);for(inti=0;i
|
|