Unique file name for multi-threading apps.

  • Thread starter Thread starter Manuel
  • Start date Start date
M

Manuel

I've playing around with multi-threading applications lately. The main
problem I have is that when I create a file/table/whatever I need a
unique name. The only way I could come up with, is asking for a
temporary file (System.IO.Path.GetTempFileName) and that file name would
be the unique character string I was looking for.

The same goes for the log report files. I have to use the temp file name
as seed for the random, wait that amount of secs and then write to the
file. It has been the only way I could find for the threads not
colliding with one another.

The random function alone doesn't work simply because it uses the system
clock as seed and if 2 threads happen at the same time, the random
numbers will come up the same.

Is there another way of retrieving a unique character string or number
that the threads can use?



.................................................................
Posted via TITANnews - Uncensored Newsgroups Access-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-
 
The GUID is fantastic, it works like a charm. Only problem is that it's
36 characters long, but I can live with it :)

The time doesn't cut it though (read below).
What about using a GUID or the Time ( Less the colons ) ?

OHM



.................................................................
Posted via TITANnews - Uncensored Newsgroups Access-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-
 
Glad to b of help

OHM


Manuel said:
The GUID is fantastic, it works like a charm. Only problem is that it's
36 characters long, but I can live with it :)

The time doesn't cut it though (read below).




................................................................
Posted via TITANnews - Uncensored Newsgroups Access
-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-
 
Back
Top