#include #include #include #include #include #include #include #include #define NUM_THREADS 2750 #include using namespace std; time_t sec; void *testBug(void *threadid) { MYSQL mysql; char const sql1[] = "select 1"; int r; long tid; int cancelstate=0; my_bool auto_reconnect=1; pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,&cancelstate); tid = (long)threadid; cout << endl; printf("testBug(), thread #%ld, begin\n", tid); mysql_init(&mysql); mysql_real_connect(&mysql,"127.0.0.1","root","","test",13100,NULL,NULL); while (1) { if (sec <= time(NULL)) break; sleep(1); } r = mysql_real_query(&mysql, sql1, sizeof(sql1)); printf("SQL1 result: %i\n", r); mysql_close(&mysql); mysql_thread_end(); printf("testBug(), thread #%ld, end\n", tid); pthread_exit(NULL); } int main() { pthread_t threads[NUM_THREADS]; int rc; long t; mysql_library_init(0, NULL, NULL); sec = time(NULL) + 30; for(t=0; t