📄 mypthread.c
字号:
/*mypthread.c*/#include <pthread.h>#include <stdlib.h>#include <stdio.h>#include <unistd.h>void *thread_function( void *arg ){ int i; for ( i=0; i<5; i++) { printf("This is a thread!\n"); } return NULL;}int main( void ){ pthread_t mythread; if( pthread_create( &mythread, NULL, thread_function, NULL) ) { printf("error creating thread."); } printf("This is main process!\n"); if ( pthread_join( mythread, NULL) ) { printf("error joining thread."); abort(); } printf("%d\n",pthread_self()); exit(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -