~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/thr_lock.cc

  • Committer: Monty Taylor
  • Date: 2009-01-09 07:02:24 UTC
  • mto: (779.1.2 devel)
  • mto: This revision was merged to the branch mainline in revision 784.
  • Revision ID: mordred@inaugust.com-20090109070224-prwl5p52mfql3zfw
Split out readline.

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>
79
78
 
80
79
#if TIME_WITH_SYS_TIME
81
80
# include <sys/time.h>
90
89
 
91
90
#include <drizzled/util/test.h>
92
91
 
93
 
using namespace std;
94
 
 
95
92
bool thr_lock_inited=0;
96
93
uint32_t locks_immediate = 0L, locks_waited = 0L;
97
94
uint64_t table_lock_wait_timeout;
98
95
enum thr_lock_type thr_upgraded_concurrent_insert_lock = TL_WRITE;
99
96
 
100
97
 
101
 
static list<THR_LOCK *> thr_lock_thread_list;          /* List of threads in use */
102
 
 
 
98
LIST *thr_lock_thread_list;                     /* List of threads in use */
103
99
uint64_t max_write_lock_count= ~(uint64_t) 0L;
104
100
 
105
101
static inline pthread_cond_t *get_cond(void)
136
132
  lock->write.last= &lock->write.data;
137
133
 
138
134
  pthread_mutex_lock(&THR_LOCK_lock);           /* Add to locks in use */
139
 
  thr_lock_thread_list.push_front(lock);
 
135
  lock->list.data=(void*) lock;
 
136
  thr_lock_thread_list=list_add(thr_lock_thread_list,&lock->list);
140
137
  pthread_mutex_unlock(&THR_LOCK_lock);
141
138
  return;
142
139
}
146
143
{
147
144
  pthread_mutex_destroy(&lock->mutex);
148
145
  pthread_mutex_lock(&THR_LOCK_lock);
149
 
  thr_lock_thread_list.remove(lock);
 
146
  thr_lock_thread_list=list_delete(thr_lock_thread_list,&lock->list);
150
147
  pthread_mutex_unlock(&THR_LOCK_lock);
151
148
  return;
152
149
}
688
685
*/
689
686
 
690
687
 
691
 
#define LOCK_CMP(A,B) ((unsigned char*) (A->lock) - (uint32_t) ((A)->type) < (unsigned char*) (B->lock)- (uint32_t) ((B)->type))
 
688
#define LOCK_CMP(A,B) ((unsigned char*) (A->lock) - (uint) ((A)->type) < (unsigned char*) (B->lock)- (uint) ((B)->type))
692
689
 
693
690
static void sort_locks(THR_LOCK_DATA **data,uint32_t count)
694
691
{
723
720
    enum enum_thr_lock_result result= thr_lock(*pos, owner, (*pos)->type);
724
721
    if (result != THR_LOCK_SUCCESS)
725
722
    {                                           /* Aborted */
726
 
      thr_multi_unlock(data,(uint32_t) (pos-data));
 
723
      thr_multi_unlock(data,(uint) (pos-data));
727
724
      return(result);
728
725
    }
729
726
  }