📄 test02.c
字号:
#include "unpthread.h"void *myfunc(void *ptr){ int val; printf("thread ID of myfunc: %d\n", pthread_self()); val = *((int *) ptr); printf("val = %d\n", val); sleep(10); val = *((int *) ptr); printf("val = %d\n", val);}intmain(int argc, char **argv){ pthread_t tid; int n, val; printf("thread ID of main: %d\n", pthread_self()); /* Let's verify that the value pointed to the thread's argument is modifiable */ val = 123; if ( (n = pthread_create(&tid, NULL, myfunc, &val)) != 0) errno = n, err_sys("pthread_create error"); sleep(5); val = 789; sleep(20); exit(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -