I believe that what you described is perfectly acceptable. The thing to keep in mind is the thread_init allocates thread specific memory for mysql, and the thread_end clears it. As such you should never execute any other mysql commands unless you have executed an init, and you should never init more than once without first ending, but assuming you get them all matched up right it is alright to have multiple init/end pairs within a thread.
I do this in my own code, which has worked well for sometime now, so while the manual doesn't make it completely clear this is ok, I'm pretty sure it is. One note, I see you write my_thread_init/my_thread_end in your message, the correct names are mysql_thread_init and mysql_thread_end, the my_init function should be called once per process, not in each thread. John On Wed, 2004-10-13 at 10:39 +0100, Philippe Poelvoorde wrote: > Hi, > > I'm using the C api within a multithread environement. Is that allright > if I have a function that looks like this : > saveParam(){ > my_thread_init(); > [connexion/query/close] > my_thread_end(); > } > > Can I call it several time from the same thread ? Or do I have to do > my_thread_init/end only once for each thread ? > > -- > Philippe Poelvoorde > COS Trading Ltd. > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]