Imperio59 wrote:
>
> Another option was to start up the connection to the database when the
> server loads and keep it alive all throughout the duration of a round,
> but I think that would be a cheap and wrong way to do it...
Believe it or not, this is pretty much the accepted way to do this.
Keeping connections open is not terribly expensive, unless you have too
many of them; in which case, what you really should do is have a server
which holds a connection.
It doesn't sound, to me, like threads will really be your answer. To
properly utilize a thread, you'll need to have some way to pass data
from your main program to your thread, and back, and that runs into fun
locking issues that are well beyond this forum.
Lastly, Warren thinks mysql++ is probably thread-safe, but it can't be
guaranteed. I use mysql++ in a thread on linux, and I seem to be doing
pretty well with it, but I have a very limited usage of it.
At the very least, you have a fun problem on your hands. Good luck
solving it!