简体   繁体   中英

pthread_self used without pthread_create

I am looking at this example code in http://man7.org/linux/man-pages/man3/pthread_setaffinity_np.3.html

In this example, why pthread_self could be used without pthread_create? I thought a program needs to call pthread_create to create a pthread then calls pthread_self to return the pthread id.

pthread_create is used to create a new (usually worker) thread. pthread_self is used to return thread identifier of the thread which calls it. It can also be the main thread .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM