tags:

views:

383

answers:

2

Is FindFirst,FindNext & FindClose Thread safe in delphi ? If not what should be used in there place ?

+13  A: 

FindFirst, FindNext & FindClose use API calls and they are Thread safe. Every thread must use its own API handle for file access.

GJ
No, they are not API calls. Go see for yourself in *SysUtils.pas*.
Rob Kennedy
Yes you right but use API calls and all local variables are stored on the stack except TSearchRec. So if you don't share the TSearchRec between threads it is Thread safe.
GJ
edited to address Rob's comment
Argalatyr
+5  A: 

If you don't use a shared TSearchRec variable the routines are thread safe.

Tihauan
TSearchRec is defined in the 'Execute' part of the thread
Charles Faiga