How do I know my Q-KEY is unique ?
Conor P. Cahill
cpcahil at virtech.UUCP
Sun Sep 24 06:57:11 AEST 1989
In article <1747 at draken.nada.kth.se>, d88-jwa at nada.kth.se (Jon W{tte) writes:
> I am currently considering using message queues for a game I'm writing.
> The problem is: when I create a message queue, I pass a (hopefully)
> unique 32-bit key. How do I make SURE this key is unique ? (I need to
> compile the key into a server as well as a client...)
There is no way to "register" or reserve an IPC key value. Most software
that I have seen using ipc's has used one of the following:
1. have the initial process obtain a "private" IPC and write the
IPC id into a file that is read by all other programs using the
IPC. Note that this is better than selecting an unused key
because you don't have to hunt around.
2. Use a control file that has the specified key.
3. #2 but allow for an override by an environment variable.
4. hard code in a specific key and hope you don't collide. This is
the worst solution.
--
+-----------------------------------------------------------------------+
| Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 !
| Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 |
+-----------------------------------------------------------------------+
More information about the Comp.unix.wizards
mailing list