| 764 | } |
| 765 | |
| 766 | struct sql_thread *start_sql_thread(void) |
| 767 | { |
| 768 | struct sql_thread *thd = calloc(1, sizeof(struct sql_thread)); |
| 769 | if (!thd) { |
| 770 | logmsg(LOGMSG_ERROR, "%s: calloc failed\n", __func__); |
| 771 | return NULL; |
| 772 | } |
| 773 | listc_init(&thd->query_stats, offsetof(struct query_path_component, lnk)); |
| 774 | thd->query_hash = hash_init_user(query_path_component_hash, |
| 775 | query_path_component_cmp, 0, 0); |
| 776 | Pthread_mutex_init(&thd->lk, NULL); |
| 777 | Pthread_setspecific(query_info_key, thd); |
| 778 | Pthread_mutex_lock(&gbl_sql_lock); |
| 779 | listc_abl(&thedb->sql_threads, thd); |
| 780 | Pthread_mutex_unlock(&gbl_sql_lock); |
| 781 | |
| 782 | thd->crtshard = 0; |
| 783 | |
| 784 | return thd; |
| 785 | } |
| 786 | |
| 787 | static int free_queryhash(void *obj, void *arg) |
| 788 | { |
no test coverage detected