System V message queues?
Lars Pensj|
lars at myab.se
Thu Mar 2 23:09:55 AEST 1989
In article <4043 at ingr.com> crossgl at ingr.UUCP (Gordon Cross) writes:
>The correct way to use message
>queues for interprocess communication is to create it using a value for
>'key' that is known (or can be determined) by the other processes that wish
>to use the queue. There is a function 'ftok' available that can be used to
>generate such a key. It requires the path name of an existing file and an
>unique id (the manual suggests that this id should uniquely identify a
>project). My personal opinion of 'ftok' is UGHHHH! I usually just pick
>some random number and use that as the key then we register this number so
>no other project will use the same one.
My opinion of ftok() is that it should have been mandatory. If you use
ftok() on a local file, you will get a unique key. If you want more than
one unique key, use an id value of 0, 1 and so on for the same file.
Never use a random number, it can collide with other programs !
--
Lars Pensj|
lars at myab.se
More information about the Comp.unix.questions
mailing list