I have a problem sharing mysql structs between processes.  I am using
shared memory 
to accomplish this.  When my program starts, I create a shm segment.
Let's say I simply 
fill it with one MYSQL struct.

// parent process setting up shm for it's children
int shmid = shmget(2181973, sizeof(MYSQL), 0600|IPC_CREAT);
m = (MYSQL *)shmat(shmid, (void *)0, 0);
mysql_init(m);
shmdt(m);

The first child fork'd from the above parent will have to connect.  To
do this, it will have
to use an inherited shmid to attach, figure out if it needs to connect
and then perform queries.
The problem here is when that child dies, the connection goes with it.
If I create the
connection in the parent, then there is no problem; hundreds of clients
can share any number
of connections I may have allocated with shm.   It works when connected
in the parent
because the parent is last to die.  The children come and go.  Since the
parent does not die,
neither do the connections.

Anyone have any clues for me.  How to connect in one process and store
that connection for another?
In the situation above, every new fork I create has to reconnect.   


---------------------------------------------------------------------
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