~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/thr_lock.cc

  • Committer: Brian Aker
  • Date: 2009-03-22 21:27:04 UTC
  • mfrom: (960.2.22 mordred)
  • Revision ID: brian@tangent.org-20090322212704-ysn4mkkjg2u9kv22
Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
#include "thr_lock.h"
76
76
#include <mystrings/m_string.h>
77
77
#include <errno.h>
 
78
#include <list>
78
79
 
79
80
#if TIME_WITH_SYS_TIME
80
81
# include <sys/time.h>
89
90
 
90
91
#include <drizzled/util/test.h>
91
92
 
 
93
using namespace std;
 
94
 
92
95
bool thr_lock_inited=0;
93
96
uint32_t locks_immediate = 0L, locks_waited = 0L;
94
97
uint64_t table_lock_wait_timeout;
95
98
enum thr_lock_type thr_upgraded_concurrent_insert_lock = TL_WRITE;
96
99
 
97
100
 
98
 
LIST *thr_lock_thread_list;                     /* List of threads in use */
 
101
static list<THR_LOCK *> thr_lock_thread_list;          /* List of threads in use */
 
102
 
99
103
uint64_t max_write_lock_count= ~(uint64_t) 0L;
100
104
 
101
105
static inline pthread_cond_t *get_cond(void)
132
136
  lock->write.last= &lock->write.data;
133
137
 
134
138
  pthread_mutex_lock(&THR_LOCK_lock);           /* Add to locks in use */
135
 
  lock->list.data=(void*) lock;
136
 
  thr_lock_thread_list=list_add(thr_lock_thread_list,&lock->list);
 
139
  thr_lock_thread_list.push_front(lock);
137
140
  pthread_mutex_unlock(&THR_LOCK_lock);
138
141
  return;
139
142
}
143
146
{
144
147
  pthread_mutex_destroy(&lock->mutex);
145
148
  pthread_mutex_lock(&THR_LOCK_lock);
146
 
  thr_lock_thread_list=list_delete(thr_lock_thread_list,&lock->list);
 
149
  thr_lock_thread_list.remove(lock);
147
150
  pthread_mutex_unlock(&THR_LOCK_lock);
148
151
  return;
149
152
}