Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!eru!luth!sunic!maxim!prc
From: prc@erbe.se (Robert Claeson)
Newsgroups: comp.unix.wizards
Subject: Re: How do I know my Q-KEY is unique ?
Keywords: msg queue, queue, message queue, ID
Message-ID: <833@maxim.erbe.se>
Date: 24 Sep 89 17:05:14 GMT
References: <1747@draken.nada.kth.se>
Reply-To: prc@erbe.se (Robert Claeson)
Organization: ERBE DATA AB, Sweden
Lines: 19

In article <1747@draken.nada.kth.se> d88-jwa@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...)

I asked about the same question about 1/2 year ago. The summary of the
respones were, that queues (and semaphores and shared memories) should
be created with the IPC_PRIVATE key. This forces a new queue to be created.
The queue id that I then get can be passed on the command-line to
subprocesses that are created (I originally needed this for a terminal
driver that I'm still writing). Some people mentioned a "ftokey()" function.
I didn't investigate it. From the descriptions that I got, it didn't seem
that ftokey is guaranteed to return a unique key.

-- 
          Robert Claeson      E-mail: rclaeson@erbe.se
	  ERBE DATA AB