简体   繁体   中英

will pthread_exit() closes the opened files too?

i have opened a file in the thread and terminated the thread using pthread_exit() routine. Will it closes the opened files too?

No. pthread_exit() doesn't close any open files.

It only releases thread-specific resources. File descriptors are process-wide and any file that you opened in a thread will remain opened and you'll have a resource leak if you call pthread_exit() before closing the file.

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