Skip to contents

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(): 11-character encoding of PID and time since epoch.

  • hash(): 11-character hash of any string (hash space = 2^64).

Usage

uid()

hash(str)

Arguments

str

A string (scalar character).

Value

A string (scalar character) that can be used as a mutex, semaphore, or message queue name.

Details

uid()s encode sequential 1/100 second intervals, beginning at the current process's start time. If the number of requested UIDs exceeds the number of 1/100 seconds that the process has been alive, then the process will momentarily sleep before returning.

A uid() begins with an uppercase letter (A - R); a hash() begins with a lowercase letter (a - v).

Examples


    library(interprocess)
    
    uid()
#> [1] "Ab3ode2bSOJ"
    
    hash('192.168.1.123:8011')
#> [1] "mGUrcriGUSA"