![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/f41975e9df70447798e1a90cef2404f9.png)
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
static pthread_t g_sttest_pthread;
static int running = 1;
static void *test_thread(void *p)
{
int status = 0;
while (running)
{
usleep(1000);
}
printf("%s[%d] test_thread \n",__func__,__LINE__);
return NULL;
}
int main()
{
pthread_create(&g_sttest_pthread, 0, test_thread, NULL);
while( 'q' != getchar() )
{
usleep(100000);
}
running = 0;
pthread_join(g_sttest_pthread, NULL);
return 0;
}
gcc pthread_test.c -o pthread_test -pthread
ltrace -S ./pthread_test
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/161aa1a56c4d4c019a790537f07c2348.png)