138
138
since creation of the array */
141
#ifdef UNIV_PFS_MUTEX
142
/* Key to register the mutex with performance schema */
143
UNIV_INTERN mysql_pfs_key_t syn_arr_mutex_key;
146
141
#ifdef UNIV_SYNC_DEBUG
147
142
/******************************************************************//**
148
143
This function is called only in the debug version. Detects a deadlock
232
227
SYNC_ARRAY_MUTEX: determines the type
233
228
of mutex protecting the data structure */
236
230
sync_array_t* arr;
231
sync_cell_t* cell_array;
238
235
ut_a(n_cells > 0);
240
237
/* Allocate memory for the data structures */
241
238
arr = ut_malloc(sizeof(sync_array_t));
242
memset(arr, 0x0, sizeof(*arr));
244
sz = sizeof(sync_cell_t) * n_cells;
245
arr->array = ut_malloc(sz);
246
memset(arr->array, 0x0, sz);
240
cell_array = ut_malloc(sizeof(sync_cell_t) * n_cells);
248
242
arr->n_cells = n_cells;
244
arr->array = cell_array;
249
245
arr->protection = protection;
251
249
/* Then create the mutex to protect the wait array complex */
252
250
if (protection == SYNC_ARRAY_OS_MUTEX) {
253
arr->os_mutex = os_mutex_create();
251
arr->os_mutex = os_mutex_create(NULL);
254
252
} else if (protection == SYNC_ARRAY_MUTEX) {
255
mutex_create(syn_arr_mutex_key,
256
&arr->mutex, SYNC_NO_ORDER_CHECK);
253
mutex_create(&arr->mutex, SYNC_NO_ORDER_CHECK);
258
for (i = 0; i < n_cells; i++) {
259
cell = sync_array_get_nth_cell(arr, i);
260
cell->wait_object = NULL;
261
cell->waiting = FALSE;
262
cell->signal_count = 0;
504
508
|| type == RW_LOCK_WAIT_EX
505
509
|| type == RW_LOCK_SHARED) {
507
fputs(type == RW_LOCK_EX ? "X-lock on"
508
: type == RW_LOCK_WAIT_EX ? "X-lock (wait_ex) on"
509
: "S-lock on", file);
511
fputs(type == RW_LOCK_EX ? "X-lock on" : "S-lock on", file);
511
513
rwlock = cell->old_wait_rw_lock;