Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DIR function, thread safe usage

Status
Not open for further replies.

Guern

Programmer
Jun 22, 2001
91
GB
Hi,

I'm wondering is the DIR function is safe for using in multiple threads at the same time within an application.

For example

You use Dir(MyPath) to get the first entry, then loop through with 'file = Dir()' to get all the other entries.

What if, during the middle of this loop another thread did a Dir(MyPath). Would'nt this mess up the rest of the already running thread?

It's not as if you are using a new instance of 'dir' each time.

If so, does anyone know of a thread safe alternative?

Thanks.
 
I sussed this. I now use directory.getfiles instead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top