📄 stress.c
字号:
#include <stdio.h> #include <pthread.h> extern void TestEntry();int main(void) { int i = 0; pthread_t tid1,tid2, tid3; pthread_t tid4,tid5, tid6; pthread_attr_t attr; pthread_attr_init(&attr); //pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); for(i = 0; i < 50; i++) { pthread_create(&tid1, &attr, (void *)TestEntry, NULL); pthread_create(&tid2, &attr, (void *)TestEntry, NULL); pthread_create(&tid3, &attr, (void *)TestEntry, NULL); pthread_create(&tid4, &attr, (void *)TestEntry, NULL); pthread_create(&tid5, &attr, (void *)TestEntry, NULL); } printf("main thread exit\n"); return 0; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -