i have opened a file in the thread and terminated the thread using pthread_exit() routine. Will it closes the opened files too?
Asked
Active
Viewed 189 times
1 Answers
2
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.

P.P
- 117,907
- 20
- 175
- 238
-
And don't be tempted to call fcloseall() either in your thread! – bazza Mar 16 '15 at 06:59