~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/sync/sync0arr.c

  • Committer: lbieber
  • Date: 2010-10-05 21:14:30 UTC
  • mfrom: (1775.5.2 bug621331)
  • mto: This revision was merged to the branch mainline in revision 1814.
  • Revision ID: lbieber@orisndriz08-20101005211430-xmy19fcls25swctl
Merge Billy - fix bug 621331 - Replace use of stringstream with boost::lexical_cast

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
                                        since creation of the array */
139
139
};
140
140
 
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;
144
 
#endif
145
 
 
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 */
234
229
{
235
 
        ulint           sz;
236
230
        sync_array_t*   arr;
 
231
        sync_cell_t*    cell_array;
 
232
        sync_cell_t*    cell;
 
233
        ulint           i;
237
234
 
238
235
        ut_a(n_cells > 0);
239
236
 
240
237
        /* Allocate memory for the data structures */
241
238
        arr = ut_malloc(sizeof(sync_array_t));
242
 
        memset(arr, 0x0, sizeof(*arr));
243
239
 
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);
247
241
 
248
242
        arr->n_cells = n_cells;
 
243
        arr->n_reserved = 0;
 
244
        arr->array = cell_array;
249
245
        arr->protection = protection;
 
246
        arr->sg_count = 0;
 
247
        arr->res_count = 0;
250
248
 
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);
257
254
        } else {
258
255
                ut_error;
259
256
        }
260
257
 
 
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;
 
263
        }
 
264
 
261
265
        return(arr);
262
266
}
263
267
 
504
508
                   || type == RW_LOCK_WAIT_EX
505
509
                   || type == RW_LOCK_SHARED) {
506
510
 
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);
510
512
 
511
513
                rwlock = cell->old_wait_rw_lock;
512
514