Creating a file with the exclusive creation mode is a pretty common way to make a lock file and as far as I know that works well in posix.