Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Unique filenames with Time::HiRes

by AcidHawk (Vicar)
on Jul 19, 2004 at 14:38 UTC ( #375565=note: print w/ replies, xml ) Need Help??


in reply to Re: Unique filenames with Time::HiRes
in thread Unique filenames with Time::HiRes

Hi,

I origionally started this way, however when the daemon starts again it restarted the counter, if any previous files still existed, say at num 1001, and I restarted the daemon again, I would start creating files at number 1. This causes the files to be processed in the incorrect order.

-----
Of all the things I've lost in my life, its my mind I miss the most.


Comment on Re^2: Unique filenames with Time::HiRes
Re^3: Unique filenames with Time::HiRes
by waswas-fng (Curate) on Jul 19, 2004 at 16:34 UTC
    Why not do a gettimeofday(), test to see if the file name exists, if it does then loop for a few ms, then rinse and repeat until the gettimeofday is unique?


    -Waswas
Re^3: Unique filenames with Time::HiRes
by mutated (Monk) on Jul 20, 2004 at 13:14 UTC
    It's relatively easy though when the daemon is starting for it to check and make sure it is starting above the last number that exists, it can take it's time because until it starts responding to requests for numbers the programs calling it should just block or whatever..


    daN.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://375565]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2014-10-21 03:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (95 votes), past polls