tident.c
来自「linux thread programe」· C语言 代码 · 共 46 行
C
46 行
/******************************************************** * An example source module to accompany... * * "Using POSIX Threads: Programming with Pthreads" * by Brad nichols, Dick Buttlar, Jackie Farrell * O'Reilly & Associates, Inc. * ******************************************************** * ident.c * * Demonstrate use of pthread_self() and pthread_equal() */#include <stdio.h>#include <pthread.h>pthread_t io_thread;void * io_routine(void *notused){ pthread_t thread; thread = pthread_self(); if (pthread_equal(io_thread, thread)) printf("hey it is me!\n"); else printf("thats\' not me!\n"); return(NULL);}main(void){ extern pthread_t io_thread; pthread_create(&io_thread, NULL, io_routine, NULL); pthread_join(io_thread, NULL);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?