0

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

IPS
  • 81
  • 1
  • 12

1 Answers1

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