~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/lock.cc

  • Committer: Brian Aker
  • Date: 2010-08-17 01:34:55 UTC
  • mto: (1711.1.23 build)
  • mto: This revision was merged to the branch mainline in revision 1714.
  • Revision ID: brian@tangent.org-20100817013455-zx3nm7qilxvpwrgb
Style on structure cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
  @{
105
105
*/
106
106
 
107
 
static DRIZZLE_LOCK *get_lock_data(Session *session, Table **table,
108
 
                                   uint32_t count,
109
 
                                   bool should_lock, Table **write_locked);
 
107
static DrizzleLock *get_lock_data(Session *session, Table **table,
 
108
                                  uint32_t count,
 
109
                                  bool should_lock, Table **write_locked);
110
110
static int lock_external(Session *session, Table **table,uint32_t count);
111
111
static int unlock_external(Session *session, Table **table,uint32_t count);
112
112
static void print_lock_error(int error, const char *);
160
160
        lock request will set its lock type properly.
161
161
*/
162
162
 
163
 
static void reset_lock_data_and_free(DRIZZLE_LOCK **mysql_lock)
 
163
static void reset_lock_data_and_free(DrizzleLock **mysql_lock)
164
164
{
165
 
  DRIZZLE_LOCK *sql_lock= *mysql_lock;
 
165
  DrizzleLock *sql_lock= *mysql_lock;
166
166
  THR_LOCK_DATA **ldata, **ldata_end;
167
167
 
168
168
  /* Clear the lock type of all lock data to avoid reusage. */
178
178
}
179
179
 
180
180
 
181
 
DRIZZLE_LOCK *mysql_lock_tables(Session *session, Table **tables, uint32_t count,
 
181
DrizzleLock *mysql_lock_tables(Session *session, Table **tables, uint32_t count,
182
182
                                uint32_t flags, bool *need_reopen)
183
183
{
184
 
  DRIZZLE_LOCK *sql_lock;
 
184
  DrizzleLock *sql_lock;
185
185
  Table *write_lock_used;
186
186
  vector<plugin::StorageEngine *> involved_engines;
187
187
  int rc;
371
371
}
372
372
 
373
373
 
374
 
void mysql_unlock_tables(Session *session, DRIZZLE_LOCK *sql_lock)
 
374
void mysql_unlock_tables(Session *session, DrizzleLock *sql_lock)
375
375
{
376
376
  if (sql_lock->lock_count)
377
377
    thr_multi_unlock(sql_lock->locks,sql_lock->lock_count);
389
389
 
390
390
void mysql_unlock_some_tables(Session *session, Table **table, uint32_t count)
391
391
{
392
 
  DRIZZLE_LOCK *sql_lock;
 
392
  DrizzleLock *sql_lock;
393
393
  Table *write_lock_used;
394
394
  if ((sql_lock= get_lock_data(session, table, count, false,
395
395
                               &write_lock_used)))
401
401
  unlock all tables locked for read.
402
402
*/
403
403
 
404
 
void mysql_unlock_read_tables(Session *session, DRIZZLE_LOCK *sql_lock)
 
404
void mysql_unlock_read_tables(Session *session, DrizzleLock *sql_lock)
405
405
{
406
406
  uint32_t i,found;
407
407
 
487
487
 
488
488
void mysql_lock_abort(Session *session, Table *table)
489
489
{
490
 
  DRIZZLE_LOCK *locked;
 
490
  DrizzleLock *locked;
491
491
  Table *write_lock_used;
492
492
 
493
493
  if ((locked= get_lock_data(session, &table, 1, false,
514
514
 
515
515
bool mysql_lock_abort_for_thread(Session *session, Table *table)
516
516
{
517
 
  DRIZZLE_LOCK *locked;
 
517
  DrizzleLock *locked;
518
518
  Table *write_lock_used;
519
519
  bool result= false;
520
520
 
566
566
  @param write_lock_used   Store pointer to last table with WRITE_ALLOW_WRITE
567
567
*/
568
568
 
569
 
static DRIZZLE_LOCK *get_lock_data(Session *session, Table **table_ptr, uint32_t count,
 
569
static DrizzleLock *get_lock_data(Session *session, Table **table_ptr, uint32_t count,
570
570
                                 bool should_lock, Table **write_lock_used)
571
571
{
572
572
  uint32_t i,tables,lock_count;
573
 
  DRIZZLE_LOCK *sql_lock;
 
573
  DrizzleLock *sql_lock;
574
574
  THR_LOCK_DATA **locks, **locks_buf, **locks_start;
575
575
  Table **to, **table_buf;
576
576
 
592
592
    update the table values. So the second part of the array is copied
593
593
    from the first part immediately before calling thr_multi_lock().
594
594
  */
595
 
  if (!(sql_lock= (DRIZZLE_LOCK*)
 
595
  if (!(sql_lock= (DrizzleLock*)
596
596
        malloc(sizeof(*sql_lock) +
597
597
               sizeof(THR_LOCK_DATA*) * tables * 2 +
598
598
               sizeof(table_ptr) * lock_count)))