본문 바로가기

Programming

linux thread.c

#include <stdio.h>

#include <pthread.h>


pthread_t th;


void* func(void* a){


while(1){

printf("thread running...%d\n", getpid());

sleep(5);

}


}


int main(){


pthread_create( &th, 0, func, 0);

pthread_detach( th );

while(1){

printf("main thread running...%d\n", getpid());

sleep(5);

}

return 0;

}


'Programming' 카테고리의 다른 글

arpreply.c  (0) 2013.03.19
print segment registers.c  (0) 2013.03.19
linux 2.6 kernel modules  (0) 2013.03.19
rootkit_helper.c  (0) 2013.03.19
checksec.sh  (0) 2013.03.19