Does anybody (on this list) know anything about threaded embedded server? Where can I get info about this problem?
>I've been using mysql embedded server in my online game >project. The game server receive client requests, >and create a new thread for every request. >I made some tests with a single thread, >and found some strange things. >The following code works under Windows XP, but doesn't >work under Debian or RedHat 7.1 : > >void server_test( ... ) >{ > mysql_server_init( ... ); > mysql = mysql_init( ... ); > mysql_real_connect( mysql, ... ); > pthread_create( ... server_receive ... ) > // wait for thread end > // terminate... >} > >void *server_receive( mysql ) >{ > mysql_thread_init(); > somelogquery( mysql, "SELECT * FROM building" ); // works fine > somelogquery( mysql, "SELECT * FROM building WHERE bid==1" ); // mysql_error > mysql_thread_end(); > phtread_exit( ... ); >} > >I've got mysql error: thread stack overrun, 8-10Mb used from 192Kb stack >A simple SELECT without WHERE always succeeded, but SELECTs with WHERE always failed. >The following code works under win and linux, but it looks very ugly: > >void *server_receive( mysql ) >{ > // no mysql_thread_init(); > mysql_close( mysql ) > mysql = mysql_init( ... ); > mysql_real_connect( mysql, ... ); > somelogquery( mysql, "SELECT * FROM building" ); // works fine > somelogquery( mysql, "SELECT * FROM building WHERE bid==1" ); // mysql_error > // no mysql_thread_end(); > phtread_exit( ... ); >} > >What is wrong with the mysql_thread_... version? >Did I misunderstand something? >Why does it work under Win but doesn't under linux? >Is the close/reinit/reconnect solution much slower? > >Thanks, >Gabor Dorka --------------------------------------------------------------------- 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