atomically increment the pipe id to be thread-safe. Thanks to Mark Grosberg for repor...