[Lazarus] Safe temp file name

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed Nov 25 15:37:27 CET 2015

On 2015-11-25 13:51, Aradeonas wrote:
> So the best way in my mind is using GUID and maybe
> use it in a loop for checking not existing for extra safety.

I've used GUID's as temp file names in a CGI application for about 5
years. The CGI app gets accessed all at the same time in a classroom
environment by about 30-80 kids. I've never hit a duplicate GUID issue.
I'm not saying it is impossible, I'm just saying the chances are very
very slim.

In tiOPF I also use GUID's as Object ID's. I've multiple times imported
data which generates about 80,000-100,000 objects in memory in an
instant. Again, used this software for many years, and never hit a
single duplicate GUID.

So I think it is a pretty safe option to use as a temp file name, even
in a multi-threaded environment.

  - Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

My public PGP key:  http://tinyurl.com/graeme-pgp

More information about the Lazarus mailing list