On Fri, 2007-08-24 at 13:22 -0700, JT Moree wrote: > Guy Hulbert wrote: > > Using rand is bogus. A random number generator will repeat values. > > So you would definitely not like #2 and probably not #1. How about #3 > and $4?
I can't think of anything that guarantees a unique number ... except pulling a sequence from an ACID database (where the problem of system crashes is already solved). > > > Time (with sufficient resolution) is equivalent to a sequence ... but > > with threads, you would need a lock on the sequence generator. > > In our case a repetition is not a highly critical problem. (Not enough Repetition will break anything using a hash to sort messages by ID. > to justify using a centralized sequence generator.) Repetition just > reduces the readability of the logs. Given that the logs are even less Ah. You never know. DJB had a clever method to pick message IDs for the queue by using the inode ... but it is useless for log analysis where the mail queue has a dedicated reiser partition and the load is very LOW. I found that every message used the same inode when there was only one message at a time on the system ... :-( It solves his problem of picking a message ID which will not conflict with any other in the queue _at the same time_. > readable without these id's I'd say we are in a better position to > implement something rather than nothing. -- --gh