To ensure broad compatibility across different operating systems, names of
mutexes, semaphores, and message queues should start with a letter followed
by up to 249 alphanumeric characters. These functions generate names meeting
these requirements.
uid(): 12-character encoding of PID and time since epoch.
hash(): 12-character hash of any string (hash space = 2^64).
Usage
uid()
hash(str)
Value
A string (scalar character) that can be used as a mutex,
semaphore, or message queue name.
Arguments
str
A string (scalar character).
Details
uid()s will not collide with a hash().
uid()s never start with 'Z'.
hash()s always start with 'Z'.
uid()s will not collide with a ps::ps_string().
uid()s are always 12 characters long.
ps::ps_string()s are always 11 characters long.
uid()s will not collide with each other.
The first 4 characters encode the current PID.
The last 8 characters encode sequential 1/10000 second intervals that the
current process was alive. Attempting to generate more than 10,000 UIDs per
second will cause the process to momentarily sleep.