| Hi all,
|   I'm writing a server that multiplexes a MySQL connection to several
| clients. Since the connection has to be shared, I can't fork(), I have to
| thread. This isn't a problem, except that when I accept() and assign a
| socket descriptor, the first thread runs fine, but the next thread simply
| grabs the descriptor (since it's shared) from the previous thread and
| starts doing all its writing to that socket. Any idea how to get around
| this? If there's any good example code, please let me know.
| 
| Thanks,
| Rob

Err, how exactly is your server model setup?  Do you create a thread after
the accept call to handle the connection, or do you pre-spawn threads in a
pool?

If you allocate the socket descriptor for the client in the starting routine
for the thread, it should have its own copy.

-- 
Dan Moschuk ([EMAIL PROTECTED])
"Cure for global warming: One giant heatsink and dual fans!"


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to