1 /* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software Foundation,
21 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
22
23 #ifndef MYSQL_THREAD_H
24 #define MYSQL_THREAD_H
25
26 /**
27 @file mysql/psi/mysql_thread.h
28 Instrumentation helpers for mysys threads, mutexes,
29 read write locks and conditions.
30 This header file provides the necessary declarations
31 to use the mysys thread API with the performance schema instrumentation.
32 In some compilers (SunStudio), 'static inline' functions, when declared
33 but not used, are not optimized away (because they are unused) by default,
34 so that including a static inline function from a header file does
35 create unwanted dependencies, causing unresolved symbols at link time.
36 Other compilers, like gcc, optimize these dependencies by default.
37
38 Since the instrumented APIs declared here are wrapper on top
39 of my_thread / safemutex / etc APIs,
40 including mysql/psi/mysql_thread.h assumes that
41 the dependency on my_thread and safemutex already exists.
42 */
43 /*
44 Note: there are several orthogonal dimensions here.
45
46 Dimension 1: Instrumentation
47 HAVE_PSI_INTERFACE is defined when the instrumentation is compiled in.
48 This may happen both in debug or production builds.
49
50 Dimension 2: Debug
51 SAFE_MUTEX is defined when debug is compiled in.
52 This may happen both with and without instrumentation.
53
54 Dimension 3: Platform
55 Mutexes are implemented with one of:
56 - the pthread library
57 - fast mutexes
58 - window apis
59 This is implemented by various macro definitions in my_thread.h
60
61 This causes complexity with '#ifdef'-ery that can't be avoided.
62 */
63
64 #include "my_thread.h"
65 #include "my_thread_local.h"
66 #include "thr_mutex.h"
67 #include "thr_rwlock.h"
68 #include "mysql/psi/psi.h"
69 #ifdef MYSQL_SERVER
70 #ifndef MYSQL_DYNAMIC_PLUGIN
71 #include "pfs_thread_provider.h"
72 #endif
73 #endif
74
75 #ifndef PSI_MUTEX_CALL
76 #define PSI_MUTEX_CALL(M) PSI_DYNAMIC_CALL(M)
77 #endif
78
79 #ifndef PSI_RWLOCK_CALL
80 #define PSI_RWLOCK_CALL(M) PSI_DYNAMIC_CALL(M)
81 #endif
82
83 #ifndef PSI_COND_CALL
84 #define PSI_COND_CALL(M) PSI_DYNAMIC_CALL(M)
85 #endif
86
87 #ifndef PSI_THREAD_CALL
88 #define PSI_THREAD_CALL(M) PSI_DYNAMIC_CALL(M)
89 #endif
90
91 /**
92 @defgroup Thread_instrumentation Thread Instrumentation
93 @ingroup Instrumentation_interface
94 @{
95 */
96
97 /**
98 An instrumented mutex structure.
99 @sa mysql_mutex_t
100 */
101 struct st_mysql_mutex
102 {
103 /** The real mutex. */
104 my_mutex_t m_mutex;
105 /**
106 The instrumentation hook.
107 Note that this hook is not conditionally defined,
108 for binary compatibility of the @c mysql_mutex_t interface.
109 */
110 struct PSI_mutex *m_psi;
111 };
112
113 /**
114 Type of an instrumented mutex.
115 @c mysql_mutex_t is a drop-in replacement for @c my_mutex_t.
116 @sa mysql_mutex_assert_owner
117 @sa mysql_mutex_assert_not_owner
118 @sa mysql_mutex_init
119 @sa mysql_mutex_lock
120 @sa mysql_mutex_unlock
121 @sa mysql_mutex_destroy
122 */
123 typedef struct st_mysql_mutex mysql_mutex_t;
124
125 /**
126 An instrumented rwlock structure.
127 @sa mysql_rwlock_t
128 */
129 struct st_mysql_rwlock
130 {
131 /** The real rwlock */
132 native_rw_lock_t m_rwlock;
133 /**
134 The instrumentation hook.
135 Note that this hook is not conditionally defined,
136 for binary compatibility of the @c mysql_rwlock_t interface.
137 */
138 struct PSI_rwlock *m_psi;
139 };
140
141 /**
142 An instrumented prlock structure.
143 @sa mysql_prlock_t
144 */
145 struct st_mysql_prlock
146 {
147 /** The real prlock */
148 rw_pr_lock_t m_prlock;
149 /**
150 The instrumentation hook.
151 Note that this hook is not conditionally defined,
152 for binary compatibility of the @c mysql_rwlock_t interface.
153 */
154 struct PSI_rwlock *m_psi;
155 };
156
157 /**
158 Type of an instrumented rwlock.
159 @c mysql_rwlock_t is a drop-in replacement for @c pthread_rwlock_t.
160 @sa mysql_rwlock_init
161 @sa mysql_rwlock_rdlock
162 @sa mysql_rwlock_tryrdlock
163 @sa mysql_rwlock_wrlock
164 @sa mysql_rwlock_trywrlock
165 @sa mysql_rwlock_unlock
166 @sa mysql_rwlock_destroy
167 */
168 typedef struct st_mysql_rwlock mysql_rwlock_t;
169
170 /**
171 Type of an instrumented prlock.
172 A prlock is a read write lock that 'prefers readers' (pr).
173 @c mysql_prlock_t is a drop-in replacement for @c rw_pr_lock_t.
174 @sa mysql_prlock_init
175 @sa mysql_prlock_rdlock
176 @sa mysql_prlock_wrlock
177 @sa mysql_prlock_unlock
178 @sa mysql_prlock_destroy
179 */
180 typedef struct st_mysql_prlock mysql_prlock_t;
181
182 /**
183 An instrumented cond structure.
184 @sa mysql_cond_t
185 */
186 struct st_mysql_cond
187 {
188 /** The real condition */
189 native_cond_t m_cond;
190 /**
191 The instrumentation hook.
192 Note that this hook is not conditionally defined,
193 for binary compatibility of the @c mysql_cond_t interface.
194 */
195 struct PSI_cond *m_psi;
196 };
197
198 /**
199 Type of an instrumented condition.
200 @c mysql_cond_t is a drop-in replacement for @c native_cond_t.
201 @sa mysql_cond_init
202 @sa mysql_cond_wait
203 @sa mysql_cond_timedwait
204 @sa mysql_cond_signal
205 @sa mysql_cond_broadcast
206 @sa mysql_cond_destroy
207 */
208 typedef struct st_mysql_cond mysql_cond_t;
209
210 /*
211 Consider the following code:
212 static inline void foo() { bar(); }
213 when foo() is never called.
214
215 With gcc, foo() is a local static function, so the dependencies
216 are optimized away at compile time, and there is no dependency on bar().
217 With other compilers (HP, Sun Studio), the function foo() implementation
218 is compiled, and bar() needs to be present to link.
219
220 Due to the existing header dependencies in MySQL code, this header file
221 is sometime used when it is not needed, which in turn cause link failures
222 on some platforms.
223 The proper fix would be to cut these extra dependencies in the calling code.
224 DISABLE_MYSQL_THREAD_H is a work around to limit dependencies.
225 DISABLE_MYSQL_PRLOCK_H is similar, and is used to disable specifically
226 the prlock wrappers.
227 */
228 #ifndef DISABLE_MYSQL_THREAD_H
229
230 /**
231 @def mysql_mutex_assert_owner(M)
232 Wrapper, to use safe_mutex_assert_owner with instrumented mutexes.
233 @c mysql_mutex_assert_owner is a drop-in replacement
234 for @c safe_mutex_assert_owner.
235 */
236 #ifdef SAFE_MUTEX
237 #define mysql_mutex_assert_owner(M) \
238 safe_mutex_assert_owner(&(M)->m_mutex);
239 #else
240 #define mysql_mutex_assert_owner(M) { }
241 #endif
242
243 /**
244 @def mysql_mutex_assert_not_owner(M)
245 Wrapper, to use safe_mutex_assert_not_owner with instrumented mutexes.
246 @c mysql_mutex_assert_not_owner is a drop-in replacement
247 for @c safe_mutex_assert_not_owner.
248 */
249 #ifdef SAFE_MUTEX
250 #define mysql_mutex_assert_not_owner(M) \
251 safe_mutex_assert_not_owner(&(M)->m_mutex);
252 #else
253 #define mysql_mutex_assert_not_owner(M) { }
254 #endif
255
256 /**
257 @def mysql_prlock_assert_write_owner(M)
258 Drop-in replacement
259 for @c rw_pr_lock_assert_write_owner.
260 */
261 #define mysql_prlock_assert_write_owner(M) \
262 rw_pr_lock_assert_write_owner(&(M)->m_prlock)
263
264 /**
265 @def mysql_prlock_assert_not_write_owner(M)
266 Drop-in replacement
267 for @c rw_pr_lock_assert_not_write_owner.
268 */
269 #define mysql_prlock_assert_not_write_owner(M) \
270 rw_pr_lock_assert_not_write_owner(&(M)->m_prlock)
271
272 /**
273 @def mysql_mutex_register(P1, P2, P3)
274 Mutex registration.
275 */
276 #define mysql_mutex_register(P1, P2, P3) \
277 inline_mysql_mutex_register(P1, P2, P3)
278
279 /**
280 @def mysql_mutex_init(K, M, A)
281 Instrumented mutex_init.
282 @c mysql_mutex_init is a replacement for @c pthread_mutex_init.
283 @param K The PSI_mutex_key for this instrumented mutex
284 @param M The mutex to initialize
285 @param A Mutex attributes
286 */
287
288 #ifdef HAVE_PSI_MUTEX_INTERFACE
289 #ifdef SAFE_MUTEX
290 #define mysql_mutex_init(K, M, A) \
291 inline_mysql_mutex_init(K, M, A, __FILE__, __LINE__)
292 #else
293 #define mysql_mutex_init(K, M, A) \
294 inline_mysql_mutex_init(K, M, A)
295 #endif
296 #else
297 #ifdef SAFE_MUTEX
298 #define mysql_mutex_init(K, M, A) \
299 inline_mysql_mutex_init(M, A, __FILE__, __LINE__)
300 #else
301 #define mysql_mutex_init(K, M, A) \
302 inline_mysql_mutex_init(M, A)
303 #endif
304 #endif
305
306 /**
307 @def mysql_mutex_destroy(M)
308 Instrumented mutex_destroy.
309 @c mysql_mutex_destroy is a drop-in replacement
310 for @c pthread_mutex_destroy.
311 */
312 #ifdef SAFE_MUTEX
313 #define mysql_mutex_destroy(M) \
314 inline_mysql_mutex_destroy(M, __FILE__, __LINE__)
315 #else
316 #define mysql_mutex_destroy(M) \
317 inline_mysql_mutex_destroy(M)
318 #endif
319
320 /**
321 @def mysql_mutex_lock(M)
322 Instrumented mutex_lock.
323 @c mysql_mutex_lock is a drop-in replacement for @c pthread_mutex_lock.
324 @param M The mutex to lock
325 */
326
327 #if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE)
328 #define mysql_mutex_lock(M) \
329 inline_mysql_mutex_lock(M, __FILE__, __LINE__)
330 #else
331 #define mysql_mutex_lock(M) \
332 inline_mysql_mutex_lock(M)
333 #endif
334
335 /**
336 @def mysql_mutex_trylock(M)
337 Instrumented mutex_lock.
338 @c mysql_mutex_trylock is a drop-in replacement
339 for @c my_mutex_trylock.
340 */
341
342 #if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE)
343 #define mysql_mutex_trylock(M) \
344 inline_mysql_mutex_trylock(M, __FILE__, __LINE__)
345 #else
346 #define mysql_mutex_trylock(M) \
347 inline_mysql_mutex_trylock(M)
348 #endif
349
350 /**
351 @def mysql_mutex_unlock(M)
352 Instrumented mutex_unlock.
353 @c mysql_mutex_unlock is a drop-in replacement for @c pthread_mutex_unlock.
354 */
355 #ifdef SAFE_MUTEX
356 #define mysql_mutex_unlock(M) \
357 inline_mysql_mutex_unlock(M, __FILE__, __LINE__)
358 #else
359 #define mysql_mutex_unlock(M) \
360 inline_mysql_mutex_unlock(M)
361 #endif
362
363 /**
364 @def mysql_rwlock_register(P1, P2, P3)
365 Rwlock registration.
366 */
367 #define mysql_rwlock_register(P1, P2, P3) \
368 inline_mysql_rwlock_register(P1, P2, P3)
369
370 /**
371 @def mysql_rwlock_init(K, RW)
372 Instrumented rwlock_init.
373 @c mysql_rwlock_init is a replacement for @c pthread_rwlock_init.
374 Note that pthread_rwlockattr_t is not supported in MySQL.
375 @param K The PSI_rwlock_key for this instrumented rwlock
376 @param RW The rwlock to initialize
377 */
378 #ifdef HAVE_PSI_RWLOCK_INTERFACE
379 #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(K, RW)
380 #else
381 #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(RW)
382 #endif
383
384 /**
385 @def mysql_prlock_init(K, RW)
386 Instrumented rw_pr_init.
387 @c mysql_prlock_init is a replacement for @c rw_pr_init.
388 @param K The PSI_rwlock_key for this instrumented prlock
389 @param RW The prlock to initialize
390 */
391 #ifdef HAVE_PSI_RWLOCK_INTERFACE
392 #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(K, RW)
393 #else
394 #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(RW)
395 #endif
396
397 /**
398 @def mysql_rwlock_destroy(RW)
399 Instrumented rwlock_destroy.
400 @c mysql_rwlock_destroy is a drop-in replacement
401 for @c pthread_rwlock_destroy.
402 */
403 #define mysql_rwlock_destroy(RW) inline_mysql_rwlock_destroy(RW)
404
405 /**
406 @def mysql_prlock_destroy(RW)
407 Instrumented rw_pr_destroy.
408 @c mysql_prlock_destroy is a drop-in replacement
409 for @c rw_pr_destroy.
410 */
411 #define mysql_prlock_destroy(RW) inline_mysql_prlock_destroy(RW)
412
413 /**
414 @def mysql_rwlock_rdlock(RW)
415 Instrumented rwlock_rdlock.
416 @c mysql_rwlock_rdlock is a drop-in replacement
417 for @c pthread_rwlock_rdlock.
418 */
419 #ifdef HAVE_PSI_RWLOCK_INTERFACE
420 #define mysql_rwlock_rdlock(RW) \
421 inline_mysql_rwlock_rdlock(RW, __FILE__, __LINE__)
422 #else
423 #define mysql_rwlock_rdlock(RW) \
424 inline_mysql_rwlock_rdlock(RW)
425 #endif
426
427 /**
428 @def mysql_prlock_rdlock(RW)
429 Instrumented rw_pr_rdlock.
430 @c mysql_prlock_rdlock is a drop-in replacement
431 for @c rw_pr_rdlock.
432 */
433 #ifdef HAVE_PSI_RWLOCK_INTERFACE
434 #define mysql_prlock_rdlock(RW) \
435 inline_mysql_prlock_rdlock(RW, __FILE__, __LINE__)
436 #else
437 #define mysql_prlock_rdlock(RW) \
438 inline_mysql_prlock_rdlock(RW)
439 #endif
440
441 /**
442 @def mysql_rwlock_wrlock(RW)
443 Instrumented rwlock_wrlock.
444 @c mysql_rwlock_wrlock is a drop-in replacement
445 for @c pthread_rwlock_wrlock.
446 */
447 #ifdef HAVE_PSI_RWLOCK_INTERFACE
448 #define mysql_rwlock_wrlock(RW) \
449 inline_mysql_rwlock_wrlock(RW, __FILE__, __LINE__)
450 #else
451 #define mysql_rwlock_wrlock(RW) \
452 inline_mysql_rwlock_wrlock(RW)
453 #endif
454
455 /**
456 @def mysql_prlock_wrlock(RW)
457 Instrumented rw_pr_wrlock.
458 @c mysql_prlock_wrlock is a drop-in replacement
459 for @c rw_pr_wrlock.
460 */
461 #ifdef HAVE_PSI_RWLOCK_INTERFACE
462 #define mysql_prlock_wrlock(RW) \
463 inline_mysql_prlock_wrlock(RW, __FILE__, __LINE__)
464 #else
465 #define mysql_prlock_wrlock(RW) \
466 inline_mysql_prlock_wrlock(RW)
467 #endif
468
469 /**
470 @def mysql_rwlock_tryrdlock(RW)
471 Instrumented rwlock_tryrdlock.
472 @c mysql_rwlock_tryrdlock is a drop-in replacement
473 for @c pthread_rwlock_tryrdlock.
474 */
475 #ifdef HAVE_PSI_RWLOCK_INTERFACE
476 #define mysql_rwlock_tryrdlock(RW) \
477 inline_mysql_rwlock_tryrdlock(RW, __FILE__, __LINE__)
478 #else
479 #define mysql_rwlock_tryrdlock(RW) \
480 inline_mysql_rwlock_tryrdlock(RW)
481 #endif
482
483 /**
484 @def mysql_rwlock_trywrlock(RW)
485 Instrumented rwlock_trywrlock.
486 @c mysql_rwlock_trywrlock is a drop-in replacement
487 for @c pthread_rwlock_trywrlock.
488 */
489 #ifdef HAVE_PSI_RWLOCK_INTERFACE
490 #define mysql_rwlock_trywrlock(RW) \
491 inline_mysql_rwlock_trywrlock(RW, __FILE__, __LINE__)
492 #else
493 #define mysql_rwlock_trywrlock(RW) \
494 inline_mysql_rwlock_trywrlock(RW)
495 #endif
496
497 /**
498 @def mysql_rwlock_unlock(RW)
499 Instrumented rwlock_unlock.
500 @c mysql_rwlock_unlock is a drop-in replacement
501 for @c pthread_rwlock_unlock.
502 */
503 #define mysql_rwlock_unlock(RW) inline_mysql_rwlock_unlock(RW)
504
505 /**
506 @def mysql_prlock_unlock(RW)
507 Instrumented rw_pr_unlock.
508 @c mysql_prlock_unlock is a drop-in replacement
509 for @c rw_pr_unlock.
510 */
511 #define mysql_prlock_unlock(RW) inline_mysql_prlock_unlock(RW)
512
513 /**
514 @def mysql_cond_register(P1, P2, P3)
515 Cond registration.
516 */
517 #define mysql_cond_register(P1, P2, P3) \
518 inline_mysql_cond_register(P1, P2, P3)
519
520 /**
521 @def mysql_cond_init(K, C)
522 Instrumented cond_init.
523 @c mysql_cond_init is a replacement for @c pthread_cond_init.
524 Note that pthread_condattr_t is not supported in MySQL.
525 @param C The cond to initialize
526 @param K The PSI_cond_key for this instrumented cond
527
528 */
529 #ifdef HAVE_PSI_COND_INTERFACE
530 #define mysql_cond_init(K, C) inline_mysql_cond_init(K, C)
531 #else
532 #define mysql_cond_init(K, C) inline_mysql_cond_init(C)
533 #endif
534
535 /**
536 @def mysql_cond_destroy(C)
537 Instrumented cond_destroy.
538 @c mysql_cond_destroy is a drop-in replacement for @c pthread_cond_destroy.
539 */
540 #define mysql_cond_destroy(C) inline_mysql_cond_destroy(C)
541
542 /**
543 @def mysql_cond_wait(C)
544 Instrumented cond_wait.
545 @c mysql_cond_wait is a drop-in replacement for @c native_cond_wait.
546 */
547 #if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE)
548 #define mysql_cond_wait(C, M) \
549 inline_mysql_cond_wait(C, M, __FILE__, __LINE__)
550 #else
551 #define mysql_cond_wait(C, M) \
552 inline_mysql_cond_wait(C, M)
553 #endif
554
555 /**
556 @def mysql_cond_timedwait(C, M, W)
557 Instrumented cond_timedwait.
558 @c mysql_cond_timedwait is a drop-in replacement
559 for @c native_cond_timedwait.
560 */
561 #if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE)
562 #define mysql_cond_timedwait(C, M, W) \
563 inline_mysql_cond_timedwait(C, M, W, __FILE__, __LINE__)
564 #else
565 #define mysql_cond_timedwait(C, M, W) \
566 inline_mysql_cond_timedwait(C, M, W)
567 #endif
568
569 /**
570 @def mysql_cond_signal(C)
571 Instrumented cond_signal.
572 @c mysql_cond_signal is a drop-in replacement for @c pthread_cond_signal.
573 */
574 #define mysql_cond_signal(C) inline_mysql_cond_signal(C)
575
576 /**
577 @def mysql_cond_broadcast(C)
578 Instrumented cond_broadcast.
579 @c mysql_cond_broadcast is a drop-in replacement
580 for @c pthread_cond_broadcast.
581 */
582 #define mysql_cond_broadcast(C) inline_mysql_cond_broadcast(C)
583
584 /**
585 @def mysql_thread_register(P1, P2, P3)
586 Thread registration.
587 */
588 #define mysql_thread_register(P1, P2, P3) \
589 inline_mysql_thread_register(P1, P2, P3)
590
591 /**
592 @def mysql_thread_create(K, P1, P2, P3, P4)
593 Instrumented my_thread_create.
594 This function creates both the thread instrumentation and a thread.
595 @c mysql_thread_create is a replacement for @c my_thread_create.
596 The parameter P4 (or, if it is NULL, P1) will be used as the
597 instrumented thread "indentity".
598 Providing a P1 / P4 parameter with a different value for each call
599 will on average improve performances, since this thread identity value
600 is used internally to randomize access to data and prevent contention.
601 This is optional, and the improvement is not guaranteed, only statistical.
602 @param K The PSI_thread_key for this instrumented thread
603 @param P1 my_thread_create parameter 1
604 @param P2 my_thread_create parameter 2
605 @param P3 my_thread_create parameter 3
606 @param P4 my_thread_create parameter 4
607 */
608 #ifdef HAVE_PSI_THREAD_INTERFACE
609 #define mysql_thread_create(K, P1, P2, P3, P4) \
610 inline_mysql_thread_create(K, P1, P2, P3, P4)
611 #else
612 #define mysql_thread_create(K, P1, P2, P3, P4) \
613 my_thread_create(P1, P2, P3, P4)
614 #endif
615
616 /**
617 @def mysql_thread_set_psi_id(I)
618 Set the thread identifier for the instrumentation.
619 @param I The thread identifier
620 */
621 #ifdef HAVE_PSI_THREAD_INTERFACE
622 #define mysql_thread_set_psi_id(I) inline_mysql_thread_set_psi_id(I)
623 #else
624 #define mysql_thread_set_psi_id(I) do {} while (0)
625 #endif
626
627 /**
628 @def mysql_thread_set_psi_THD(T)
629 Set the thread sql session for the instrumentation.
630 @param I The thread identifier
631 */
632 #ifdef HAVE_PSI_THREAD_INTERFACE
633 #define mysql_thread_set_psi_THD(T) inline_mysql_thread_set_psi_THD(T)
634 #else
635 #define mysql_thread_set_psi_THD(T) do {} while (0)
636 #endif
637
inline_mysql_mutex_register(const char * category,PSI_mutex_info * info,int count)638 static inline void inline_mysql_mutex_register(
639 #ifdef HAVE_PSI_MUTEX_INTERFACE
640 const char *category,
641 PSI_mutex_info *info,
642 int count
643 #else
644 const char *category MY_ATTRIBUTE ((unused)),
645 void *info MY_ATTRIBUTE ((unused)),
646 int count MY_ATTRIBUTE ((unused))
647 #endif
648 )
649 {
650 #ifdef HAVE_PSI_MUTEX_INTERFACE
651 PSI_MUTEX_CALL(register_mutex)(category, info, count);
652 #endif
653 }
654
inline_mysql_mutex_init(PSI_mutex_key key,mysql_mutex_t * that,const native_mutexattr_t * attr,const char * src_file,uint src_line)655 static inline int inline_mysql_mutex_init(
656 #ifdef HAVE_PSI_MUTEX_INTERFACE
657 PSI_mutex_key key,
658 #endif
659 mysql_mutex_t *that,
660 const native_mutexattr_t *attr
661 #ifdef SAFE_MUTEX
662 , const char *src_file, uint src_line
663 #endif
664 )
665 {
666 #ifdef HAVE_PSI_MUTEX_INTERFACE
667 that->m_psi= PSI_MUTEX_CALL(init_mutex)(key, &that->m_mutex);
668 #else
669 that->m_psi= NULL;
670 #endif
671 return my_mutex_init(&that->m_mutex, attr
672 #ifdef SAFE_MUTEX
673 , src_file, src_line
674 #endif
675 );
676 }
677
inline_mysql_mutex_destroy(mysql_mutex_t * that,const char * src_file,uint src_line)678 static inline int inline_mysql_mutex_destroy(
679 mysql_mutex_t *that
680 #ifdef SAFE_MUTEX
681 , const char *src_file, uint src_line
682 #endif
683 )
684 {
685 #ifdef HAVE_PSI_MUTEX_INTERFACE
686 if (that->m_psi != NULL)
687 {
688 PSI_MUTEX_CALL(destroy_mutex)(that->m_psi);
689 that->m_psi= NULL;
690 }
691 #endif
692 return my_mutex_destroy(&that->m_mutex
693 #ifdef SAFE_MUTEX
694 , src_file, src_line
695 #endif
696 );
697 }
698
inline_mysql_mutex_lock(mysql_mutex_t * that,const char * src_file,uint src_line)699 static inline int inline_mysql_mutex_lock(
700 mysql_mutex_t *that
701 #if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE)
702 , const char *src_file, uint src_line
703 #endif
704 )
705 {
706 int result;
707
708 #ifdef HAVE_PSI_MUTEX_INTERFACE
709 if (that->m_psi != NULL)
710 {
711 /* Instrumentation start */
712 PSI_mutex_locker *locker;
713 PSI_mutex_locker_state state;
714 locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi,
715 PSI_MUTEX_LOCK, src_file, src_line);
716
717 /* Instrumented code */
718 result= my_mutex_lock(&that->m_mutex
719 #ifdef SAFE_MUTEX
720 , src_file, src_line
721 #endif
722 );
723
724 /* Instrumentation end */
725 if (locker != NULL)
726 PSI_MUTEX_CALL(end_mutex_wait)(locker, result);
727
728 return result;
729 }
730 #endif
731
732 /* Non instrumented code */
733 result= my_mutex_lock(&that->m_mutex
734 #ifdef SAFE_MUTEX
735 , src_file, src_line
736 #endif
737 );
738
739 return result;
740 }
741
inline_mysql_mutex_trylock(mysql_mutex_t * that,const char * src_file,uint src_line)742 static inline int inline_mysql_mutex_trylock(
743 mysql_mutex_t *that
744 #if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE)
745 , const char *src_file, uint src_line
746 #endif
747 )
748 {
749 int result;
750
751 #ifdef HAVE_PSI_MUTEX_INTERFACE
752 if (that->m_psi != NULL)
753 {
754 /* Instrumentation start */
755 PSI_mutex_locker *locker;
756 PSI_mutex_locker_state state;
757 locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi,
758 PSI_MUTEX_TRYLOCK, src_file, src_line);
759
760 /* Instrumented code */
761 result= my_mutex_trylock(&that->m_mutex
762 #ifdef SAFE_MUTEX
763 , src_file, src_line
764 #endif
765 );
766
767 /* Instrumentation end */
768 if (locker != NULL)
769 PSI_MUTEX_CALL(end_mutex_wait)(locker, result);
770
771 return result;
772 }
773 #endif
774
775 /* Non instrumented code */
776 result= my_mutex_trylock(&that->m_mutex
777 #ifdef SAFE_MUTEX
778 , src_file, src_line
779 #endif
780 );
781
782 return result;
783 }
784
inline_mysql_mutex_unlock(mysql_mutex_t * that,const char * src_file,uint src_line)785 static inline int inline_mysql_mutex_unlock(
786 mysql_mutex_t *that
787 #ifdef SAFE_MUTEX
788 , const char *src_file, uint src_line
789 #endif
790 )
791 {
792 int result;
793
794 #ifdef HAVE_PSI_MUTEX_INTERFACE
795 if (that->m_psi != NULL)
796 PSI_MUTEX_CALL(unlock_mutex)(that->m_psi);
797 #endif
798
799 result= my_mutex_unlock(&that->m_mutex
800 #ifdef SAFE_MUTEX
801 , src_file, src_line
802 #endif
803 );
804
805 return result;
806 }
807
inline_mysql_rwlock_register(const char * category,PSI_rwlock_info * info,int count)808 static inline void inline_mysql_rwlock_register(
809 #ifdef HAVE_PSI_RWLOCK_INTERFACE
810 const char *category,
811 PSI_rwlock_info *info,
812 int count
813 #else
814 const char *category MY_ATTRIBUTE ((unused)),
815 void *info MY_ATTRIBUTE ((unused)),
816 int count MY_ATTRIBUTE ((unused))
817 #endif
818 )
819 {
820 #ifdef HAVE_PSI_RWLOCK_INTERFACE
821 PSI_RWLOCK_CALL(register_rwlock)(category, info, count);
822 #endif
823 }
824
inline_mysql_rwlock_init(PSI_rwlock_key key,mysql_rwlock_t * that)825 static inline int inline_mysql_rwlock_init(
826 #ifdef HAVE_PSI_RWLOCK_INTERFACE
827 PSI_rwlock_key key,
828 #endif
829 mysql_rwlock_t *that)
830 {
831 #ifdef HAVE_PSI_RWLOCK_INTERFACE
832 that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_rwlock);
833 #else
834 that->m_psi= NULL;
835 #endif
836 return native_rw_init(&that->m_rwlock);
837 }
838
839 #ifndef DISABLE_MYSQL_PRLOCK_H
inline_mysql_prlock_init(PSI_rwlock_key key,mysql_prlock_t * that)840 static inline int inline_mysql_prlock_init(
841 #ifdef HAVE_PSI_RWLOCK_INTERFACE
842 PSI_rwlock_key key,
843 #endif
844 mysql_prlock_t *that)
845 {
846 #ifdef HAVE_PSI_RWLOCK_INTERFACE
847 that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_prlock);
848 #else
849 that->m_psi= NULL;
850 #endif
851 return rw_pr_init(&that->m_prlock);
852 }
853 #endif
854
inline_mysql_rwlock_destroy(mysql_rwlock_t * that)855 static inline int inline_mysql_rwlock_destroy(
856 mysql_rwlock_t *that)
857 {
858 #ifdef HAVE_PSI_RWLOCK_INTERFACE
859 if (that->m_psi != NULL)
860 {
861 PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi);
862 that->m_psi= NULL;
863 }
864 #endif
865 return native_rw_destroy(&that->m_rwlock);
866 }
867
868 #ifndef DISABLE_MYSQL_PRLOCK_H
inline_mysql_prlock_destroy(mysql_prlock_t * that)869 static inline int inline_mysql_prlock_destroy(
870 mysql_prlock_t *that)
871 {
872 #ifdef HAVE_PSI_RWLOCK_INTERFACE
873 if (that->m_psi != NULL)
874 {
875 PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi);
876 that->m_psi= NULL;
877 }
878 #endif
879 return rw_pr_destroy(&that->m_prlock);
880 }
881 #endif
882
inline_mysql_rwlock_rdlock(mysql_rwlock_t * that,const char * src_file,uint src_line)883 static inline int inline_mysql_rwlock_rdlock(
884 mysql_rwlock_t *that
885 #ifdef HAVE_PSI_RWLOCK_INTERFACE
886 , const char *src_file, uint src_line
887 #endif
888 )
889 {
890 int result;
891
892 #ifdef HAVE_PSI_RWLOCK_INTERFACE
893 if (that->m_psi != NULL)
894 {
895 /* Instrumentation start */
896 PSI_rwlock_locker *locker;
897 PSI_rwlock_locker_state state;
898 locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi,
899 PSI_RWLOCK_READLOCK, src_file, src_line);
900
901 /* Instrumented code */
902 result= native_rw_rdlock(&that->m_rwlock);
903
904 /* Instrumentation end */
905 if (locker != NULL)
906 PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
907
908 return result;
909 }
910 #endif
911
912 /* Non instrumented code */
913 result= native_rw_rdlock(&that->m_rwlock);
914
915 return result;
916 }
917
918 #ifndef DISABLE_MYSQL_PRLOCK_H
inline_mysql_prlock_rdlock(mysql_prlock_t * that,const char * src_file,uint src_line)919 static inline int inline_mysql_prlock_rdlock(
920 mysql_prlock_t *that
921 #ifdef HAVE_PSI_RWLOCK_INTERFACE
922 , const char *src_file, uint src_line
923 #endif
924 )
925 {
926 int result;
927
928 #ifdef HAVE_PSI_RWLOCK_INTERFACE
929 if (that->m_psi != NULL)
930 {
931 /* Instrumentation start */
932 PSI_rwlock_locker *locker;
933 PSI_rwlock_locker_state state;
934 locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi,
935 PSI_RWLOCK_READLOCK, src_file, src_line);
936
937 /* Instrumented code */
938 result= rw_pr_rdlock(&that->m_prlock);
939
940 /* Instrumentation end */
941 if (locker != NULL)
942 PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
943
944 return result;
945 }
946 #endif
947
948 /* Non instrumented code */
949 result= rw_pr_rdlock(&that->m_prlock);
950
951 return result;
952 }
953 #endif
954
inline_mysql_rwlock_wrlock(mysql_rwlock_t * that,const char * src_file,uint src_line)955 static inline int inline_mysql_rwlock_wrlock(
956 mysql_rwlock_t *that
957 #ifdef HAVE_PSI_RWLOCK_INTERFACE
958 , const char *src_file, uint src_line
959 #endif
960 )
961 {
962 int result;
963
964 #ifdef HAVE_PSI_RWLOCK_INTERFACE
965 if (that->m_psi != NULL)
966 {
967 /* Instrumentation start */
968 PSI_rwlock_locker *locker;
969 PSI_rwlock_locker_state state;
970 locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi,
971 PSI_RWLOCK_WRITELOCK, src_file, src_line);
972
973 /* Instrumented code */
974 result= native_rw_wrlock(&that->m_rwlock);
975
976 /* Instrumentation end */
977 if (locker != NULL)
978 PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
979
980 return result;
981 }
982 #endif
983
984 /* Non instrumented code */
985 result= native_rw_wrlock(&that->m_rwlock);
986
987 return result;
988 }
989
990 #ifndef DISABLE_MYSQL_PRLOCK_H
inline_mysql_prlock_wrlock(mysql_prlock_t * that,const char * src_file,uint src_line)991 static inline int inline_mysql_prlock_wrlock(
992 mysql_prlock_t *that
993 #ifdef HAVE_PSI_RWLOCK_INTERFACE
994 , const char *src_file, uint src_line
995 #endif
996 )
997 {
998 int result;
999
1000 #ifdef HAVE_PSI_RWLOCK_INTERFACE
1001 if (that->m_psi != NULL)
1002 {
1003 /* Instrumentation start */
1004 PSI_rwlock_locker *locker;
1005 PSI_rwlock_locker_state state;
1006 locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi,
1007 PSI_RWLOCK_WRITELOCK, src_file, src_line);
1008
1009 /* Instrumented code */
1010 result= rw_pr_wrlock(&that->m_prlock);
1011
1012 /* Instrumentation end */
1013 if (locker != NULL)
1014 PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
1015
1016 return result;
1017 }
1018 #endif
1019
1020 /* Non instrumented code */
1021 result= rw_pr_wrlock(&that->m_prlock);
1022
1023 return result;
1024 }
1025 #endif
1026
inline_mysql_rwlock_tryrdlock(mysql_rwlock_t * that,const char * src_file,uint src_line)1027 static inline int inline_mysql_rwlock_tryrdlock(
1028 mysql_rwlock_t *that
1029 #ifdef HAVE_PSI_RWLOCK_INTERFACE
1030 , const char *src_file, uint src_line
1031 #endif
1032 )
1033 {
1034 int result;
1035
1036 #ifdef HAVE_PSI_RWLOCK_INTERFACE
1037 if (that->m_psi != NULL)
1038 {
1039 /* Instrumentation start */
1040 PSI_rwlock_locker *locker;
1041 PSI_rwlock_locker_state state;
1042 locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi,
1043 PSI_RWLOCK_TRYREADLOCK, src_file, src_line);
1044
1045 /* Instrumented code */
1046 result= native_rw_tryrdlock(&that->m_rwlock);
1047
1048 /* Instrumentation end */
1049 if (locker != NULL)
1050 PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
1051
1052 return result;
1053 }
1054 #endif
1055
1056 /* Non instrumented code */
1057 result= native_rw_tryrdlock(&that->m_rwlock);
1058
1059 return result;
1060 }
1061
inline_mysql_rwlock_trywrlock(mysql_rwlock_t * that,const char * src_file,uint src_line)1062 static inline int inline_mysql_rwlock_trywrlock(
1063 mysql_rwlock_t *that
1064 #ifdef HAVE_PSI_RWLOCK_INTERFACE
1065 , const char *src_file, uint src_line
1066 #endif
1067 )
1068 {
1069 int result;
1070
1071 #ifdef HAVE_PSI_RWLOCK_INTERFACE
1072 if (that->m_psi != NULL)
1073 {
1074 /* Instrumentation start */
1075 PSI_rwlock_locker *locker;
1076 PSI_rwlock_locker_state state;
1077 locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi,
1078 PSI_RWLOCK_TRYWRITELOCK, src_file, src_line);
1079
1080 /* Instrumented code */
1081 result= native_rw_trywrlock(&that->m_rwlock);
1082
1083 /* Instrumentation end */
1084 if (locker != NULL)
1085 PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
1086
1087 return result;
1088 }
1089 #endif
1090
1091 /* Non instrumented code */
1092 result= native_rw_trywrlock(&that->m_rwlock);
1093
1094 return result;
1095 }
1096
inline_mysql_rwlock_unlock(mysql_rwlock_t * that)1097 static inline int inline_mysql_rwlock_unlock(
1098 mysql_rwlock_t *that)
1099 {
1100 int result;
1101 #ifdef HAVE_PSI_RWLOCK_INTERFACE
1102 if (that->m_psi != NULL)
1103 PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi);
1104 #endif
1105 result= native_rw_unlock(&that->m_rwlock);
1106 return result;
1107 }
1108
1109 #ifndef DISABLE_MYSQL_PRLOCK_H
inline_mysql_prlock_unlock(mysql_prlock_t * that)1110 static inline int inline_mysql_prlock_unlock(
1111 mysql_prlock_t *that)
1112 {
1113 int result;
1114 #ifdef HAVE_PSI_RWLOCK_INTERFACE
1115 if (that->m_psi != NULL)
1116 PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi);
1117 #endif
1118 result= rw_pr_unlock(&that->m_prlock);
1119 return result;
1120 }
1121 #endif
1122
inline_mysql_cond_register(const char * category,PSI_cond_info * info,int count)1123 static inline void inline_mysql_cond_register(
1124 #ifdef HAVE_PSI_COND_INTERFACE
1125 const char *category,
1126 PSI_cond_info *info,
1127 int count
1128 #else
1129 const char *category MY_ATTRIBUTE ((unused)),
1130 void *info MY_ATTRIBUTE ((unused)),
1131 int count MY_ATTRIBUTE ((unused))
1132 #endif
1133 )
1134 {
1135 #ifdef HAVE_PSI_COND_INTERFACE
1136 PSI_COND_CALL(register_cond)(category, info, count);
1137 #endif
1138 }
1139
inline_mysql_cond_init(PSI_cond_key key,mysql_cond_t * that)1140 static inline int inline_mysql_cond_init(
1141 #ifdef HAVE_PSI_COND_INTERFACE
1142 PSI_cond_key key,
1143 #endif
1144 mysql_cond_t *that)
1145 {
1146 #ifdef HAVE_PSI_COND_INTERFACE
1147 that->m_psi= PSI_COND_CALL(init_cond)(key, &that->m_cond);
1148 #else
1149 that->m_psi= NULL;
1150 #endif
1151 return native_cond_init(&that->m_cond);
1152 }
1153
inline_mysql_cond_destroy(mysql_cond_t * that)1154 static inline int inline_mysql_cond_destroy(
1155 mysql_cond_t *that)
1156 {
1157 #ifdef HAVE_PSI_COND_INTERFACE
1158 if (that->m_psi != NULL)
1159 {
1160 PSI_COND_CALL(destroy_cond)(that->m_psi);
1161 that->m_psi= NULL;
1162 }
1163 #endif
1164 return native_cond_destroy(&that->m_cond);
1165 }
1166
inline_mysql_cond_wait(mysql_cond_t * that,mysql_mutex_t * mutex,const char * src_file,uint src_line)1167 static inline int inline_mysql_cond_wait(
1168 mysql_cond_t *that,
1169 mysql_mutex_t *mutex
1170 #if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE)
1171 , const char *src_file, uint src_line
1172 #endif
1173 )
1174 {
1175 int result;
1176
1177 #ifdef HAVE_PSI_COND_INTERFACE
1178 if (that->m_psi != NULL)
1179 {
1180 /* Instrumentation start */
1181 PSI_cond_locker *locker;
1182 PSI_cond_locker_state state;
1183 locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
1184 PSI_COND_WAIT, src_file, src_line);
1185
1186 /* Instrumented code */
1187 result= my_cond_wait(&that->m_cond, &mutex->m_mutex
1188 #ifdef SAFE_MUTEX
1189 , src_file, src_line
1190 #endif
1191 );
1192
1193 /* Instrumentation end */
1194 if (locker != NULL)
1195 PSI_COND_CALL(end_cond_wait)(locker, result);
1196
1197 return result;
1198 }
1199 #endif
1200
1201 /* Non instrumented code */
1202 result= my_cond_wait(&that->m_cond, &mutex->m_mutex
1203 #ifdef SAFE_MUTEX
1204 , src_file, src_line
1205 #endif
1206 );
1207
1208 return result;
1209 }
1210
inline_mysql_cond_timedwait(mysql_cond_t * that,mysql_mutex_t * mutex,const struct timespec * abstime,const char * src_file,uint src_line)1211 static inline int inline_mysql_cond_timedwait(
1212 mysql_cond_t *that,
1213 mysql_mutex_t *mutex,
1214 const struct timespec *abstime
1215 #if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE)
1216 , const char *src_file, uint src_line
1217 #endif
1218 )
1219 {
1220 int result;
1221
1222 #ifdef HAVE_PSI_COND_INTERFACE
1223 if (that->m_psi != NULL)
1224 {
1225 /* Instrumentation start */
1226 PSI_cond_locker *locker;
1227 PSI_cond_locker_state state;
1228 locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
1229 PSI_COND_TIMEDWAIT, src_file, src_line);
1230
1231 /* Instrumented code */
1232 result= my_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime
1233 #ifdef SAFE_MUTEX
1234 , src_file, src_line
1235 #endif
1236 );
1237
1238 /* Instrumentation end */
1239 if (locker != NULL)
1240 PSI_COND_CALL(end_cond_wait)(locker, result);
1241
1242 return result;
1243 }
1244 #endif
1245
1246 /* Non instrumented code */
1247 result= my_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime
1248 #ifdef SAFE_MUTEX
1249 , src_file, src_line
1250 #endif
1251 );
1252
1253 return result;
1254 }
1255
inline_mysql_cond_signal(mysql_cond_t * that)1256 static inline int inline_mysql_cond_signal(
1257 mysql_cond_t *that)
1258 {
1259 int result;
1260 #ifdef HAVE_PSI_COND_INTERFACE
1261 if (that->m_psi != NULL)
1262 PSI_COND_CALL(signal_cond)(that->m_psi);
1263 #endif
1264 result= native_cond_signal(&that->m_cond);
1265 return result;
1266 }
1267
inline_mysql_cond_broadcast(mysql_cond_t * that)1268 static inline int inline_mysql_cond_broadcast(
1269 mysql_cond_t *that)
1270 {
1271 int result;
1272 #ifdef HAVE_PSI_COND_INTERFACE
1273 if (that->m_psi != NULL)
1274 PSI_COND_CALL(broadcast_cond)(that->m_psi);
1275 #endif
1276 result= native_cond_broadcast(&that->m_cond);
1277 return result;
1278 }
1279
inline_mysql_thread_register(const char * category,PSI_thread_info * info,int count)1280 static inline void inline_mysql_thread_register(
1281 #ifdef HAVE_PSI_THREAD_INTERFACE
1282 const char *category,
1283 PSI_thread_info *info,
1284 int count
1285 #else
1286 const char *category MY_ATTRIBUTE ((unused)),
1287 void *info MY_ATTRIBUTE ((unused)),
1288 int count MY_ATTRIBUTE ((unused))
1289 #endif
1290 )
1291 {
1292 #ifdef HAVE_PSI_THREAD_INTERFACE
1293 PSI_THREAD_CALL(register_thread)(category, info, count);
1294 #endif
1295 }
1296
1297 #ifdef HAVE_PSI_THREAD_INTERFACE
inline_mysql_thread_create(PSI_thread_key key,my_thread_handle * thread,const my_thread_attr_t * attr,my_start_routine start_routine,void * arg)1298 static inline int inline_mysql_thread_create(
1299 PSI_thread_key key,
1300 my_thread_handle *thread, const my_thread_attr_t *attr,
1301 my_start_routine start_routine, void *arg)
1302 {
1303 int result;
1304 result= PSI_THREAD_CALL(spawn_thread)(key, thread, attr, start_routine, arg);
1305 return result;
1306 }
1307
inline_mysql_thread_set_psi_id(my_thread_id id)1308 static inline void inline_mysql_thread_set_psi_id(my_thread_id id)
1309 {
1310 struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)();
1311 PSI_THREAD_CALL(set_thread_id)(psi, id);
1312 }
1313
1314 #ifdef __cplusplus
1315 class THD;
inline_mysql_thread_set_psi_THD(THD * thd)1316 static inline void inline_mysql_thread_set_psi_THD(THD *thd)
1317 {
1318 struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)();
1319 PSI_THREAD_CALL(set_thread_THD)(psi, thd);
1320 }
1321 #endif /* __cplusplus */
1322
1323 #endif
1324
1325 #endif /* DISABLE_MYSQL_THREAD_H */
1326
1327 /** @} (end of group Thread_instrumentation) */
1328
1329 #endif
1330
1331