| 266 | #define DENA_THR_OFFSETOF(fld) ((char *)(&thd->fld) - (char *)thd) |
| 267 | |
| 268 | void |
| 269 | dbcontext::init_thread(const void *stack_bottom, volatile int& shutdown_flag) |
| 270 | { |
| 271 | DBG_THR(fprintf(stderr, "HNDSOCK init thread\n")); |
| 272 | { |
| 273 | my_thread_init(); |
| 274 | thd = new THD(0); |
| 275 | thd->thread_stack = (char *)stack_bottom; |
| 276 | DBG_THR(fprintf(stderr, |
| 277 | "thread_stack = %p sizeof(THD)=%zu sizeof(mtx)=%zu " |
| 278 | "O: %zu %zu %zu %zu %zu %zu %zu\n", |
| 279 | thd->thread_stack, sizeof(THD), sizeof(mysql_mutex_t), |
| 280 | DENA_THR_OFFSETOF(mdl_context), |
| 281 | DENA_THR_OFFSETOF(net), |
| 282 | DENA_THR_OFFSETOF(LOCK_thd_data), |
| 283 | DENA_THR_OFFSETOF(mysys_var), |
| 284 | DENA_THR_OFFSETOF(stmt_arena), |
| 285 | DENA_THR_OFFSETOF(limit_found_rows), |
| 286 | DENA_THR_OFFSETOF(locked_tables_list))); |
| 287 | thd->store_globals(); |
| 288 | thd->system_thread = static_cast<enum_thread_type>(1<<30UL); |
| 289 | memset(&thd->net, 0, sizeof(thd->net)); |
| 290 | if (for_write_flag) { |
| 291 | thd->variables.option_bits |= OPTION_BIN_LOG; |
| 292 | safeFree((char*) thd->db.str); |
| 293 | thd->db.str= my_strdup(PSI_NOT_INSTRUMENTED, "handlersocket", MYF(0)); |
| 294 | thd->db.length= sizeof("handlersocket")-1; |
| 295 | } |
| 296 | thd->variables.option_bits |= OPTION_TABLE_LOCK; |
| 297 | set_current_thd(thd); |
| 298 | DBG_THR(fprintf(stderr, "HNDSOCK x0 %p\n", thd)); |
| 299 | } |
| 300 | { |
| 301 | thd->thread_id = next_thread_id(); |
| 302 | server_threads.insert(thd); |
| 303 | } |
| 304 | |
| 305 | DBG_THR(fprintf(stderr, "HNDSOCK init thread wsts\n")); |
| 306 | wait_server_to_start(thd, shutdown_flag); |
| 307 | DBG_THR(fprintf(stderr, "HNDSOCK init thread done\n")); |
| 308 | |
| 309 | thd_proc_info(thd, &info_message_buf[0]); |
| 310 | set_thread_message("hs:listening"); |
| 311 | DBG_THR(fprintf(stderr, "HNDSOCK x1 %p\n", thd)); |
| 312 | |
| 313 | lex_start(thd); |
| 314 | |
| 315 | user_lock.reset(new expr_user_lock(thd, user_level_lock_timeout)); |
| 316 | } |
| 317 | |
| 318 | int |
| 319 | dbcontext::set_thread_message(const char *fmt, ...) |
no test coverage detected