~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_locking.cc

Merged padraig's removal of list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <mysys/my_tree.h>
26
26
#include <drizzled/util/test.h>
27
27
 
 
28
using namespace std;
 
29
 
28
30
        /* lock table by F_UNLCK, F_RDLCK or F_WRLCK */
29
31
 
30
32
int mi_lock_database(MI_INFO *info, int lock_type)
33
35
  uint32_t count;
34
36
  MYISAM_SHARE *share=info->s;
35
37
  uint32_t flag;
 
38
  if (!info->s->in_use)
 
39
    info->s->in_use= new list<Session *>;
36
40
 
37
41
  if (share->options & HA_OPTION_READ_ONLY_DATA ||
38
42
      info->lock_type == lock_type)
42
46
    ++share->w_locks;
43
47
    ++share->tot_locks;
44
48
    info->lock_type= lock_type;
45
 
    info->s->in_use= list_add(info->s->in_use, &info->in_use);
 
49
    info->s->in_use->push_front(info->in_use);
46
50
    return(0);
47
51
  }
48
52
 
125
129
      }
126
130
      info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
127
131
      info->lock_type= F_UNLCK;
128
 
      info->s->in_use= list_delete(info->s->in_use, &info->in_use);
 
132
      info->s->in_use->remove(info->in_use);
129
133
      break;
130
134
    case F_RDLCK:
131
135
      if (info->lock_type == F_WRLCK)
164
168
      share->r_locks++;
165
169
      share->tot_locks++;
166
170
      info->lock_type=lock_type;
167
 
      info->s->in_use= list_add(info->s->in_use, &info->in_use);
 
171
      info->s->in_use->push_front(info->in_use);
168
172
      break;
169
173
    case F_WRLCK:
170
174
      if (info->lock_type == F_RDLCK)
199
203
      info->lock_type=lock_type;
200
204
      share->w_locks++;
201
205
      share->tot_locks++;
202
 
      info->s->in_use= list_add(info->s->in_use, &info->in_use);
 
206
      info->s->in_use->push_front(info->in_use);
203
207
      break;
204
208
    default:
205
209
      break;                            /* Impossible */