# IPC message queues?



## samad_lotia (Aug 13, 2002)

I would like to use message queues in one of my programs. Does OSX not support either POSIX or System V message queues or am I setting up my programs wrong? /usr/include/sys/msg.h (for SysV message queues) and /usr/include/mqueue.h (for POSIX message queues) do not exist. I tried compiling an example program (the snippet is at the bottom) using SysV MQs without #including sys/msg.h. The program compiles fine. But when I actually run the program, I get the error:
msgget: Operation not supported
Btw, ftok() works just fine.

I noticed that in /var/spool, there are 2 directories called mqueue and clientmqueue. Very peculiar.
...
if ((msqid = msgget(key, 0644)) == -1) { /* connect to the queue */
        perror("msgget");
        exit(1);
    }
...

Samad


----------



## theed (Sep 7, 2002)

A day late and a dollar short I know, but here goes.

It's a big part of the NS Classes to pass messages between processes.  It's also fairly well documented how you can create a central messaging facility and send messages to it and have any number of processes listen to it.  This is how much of the event handling in the OS is programmed.

NSNotificationCenter - It may not at all be what you were looking for, but I think it's a pretty sweet deal.


----------

