Hi.

IMHO using MySQL as for inter-process-communication is the wrong thing
to do. Just use traditional IPC mechanisms provided by your operating
system.

If you want to do this anyhow, you could use GET_LOCK with high
timeouts to avoid the polling at cost of idling connections.

At program start:

            A                 B
            -                 GET_LOCK
            GET_LOCK (hangs)

If a gets the lock, it simply releases it again and tries again some
seconds later. Later:
                              write message
                              RELEASE_LOCK
            (gets lock)
                              GET_LOCK (hangs)
            read message
            RELEASE_LOCK
                              (gets lock and knows message is delivered) 

Well, of course you need a seperate lock name for A->B and for B->A
communication. You could use seperate lock names for all process
pairs, or "just" one for each process (that would mean that all
processes would lock on "B" and each gets awaken after the previous
has looked if the message is for it).

Another implementation would use it like a token ring, but this would
need some kind of timeout to assure that others can "say" something
when the process holding the lock is idle.

Bye,

        Benjamin.


On Mon, May 27, 2002 at 03:48:51PM -0400, [EMAIL PROTECTED] wrote:
> I have a bunch of processes running on the same machine that should be
> able to send unicast, multicast and broadcast messages to each other.
> Messages should be received in the same order that they were sent.
> 
> I'm trying to figure out how to implement that. These processes are
> already sharing the same MySQL database, so I'm thinking that a
> process which wants to send a message could INSERT it into a table,
> then another process can SELECT it to read it. This would seem to
> require all processes to constantly poll the table, though, so I'm
> thinking maybe I should use something other than MySQL for the shared
> message queue functionality...
> 
> Suggestions? Should I: (1) use MySQL as I described above, (2) use
> MySQL with some other method I haven't thought of, or (3) use
> something else?

-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to