~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/thr_lock.c

  • Committer: Monty
  • Date: 2008-10-02 14:34:18 UTC
  • Revision ID: mordred@scylla.inaugust.com-20081002143418-2mju17v3297i1h2p
Made including stdint.h work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
#include <mystrings/m_string.h>
77
77
#include <errno.h>
78
78
 
79
 
#if TIME_WITH_SYS_TIME
80
 
# include <sys/time.h>
81
 
# include <time.h>
82
 
#else
83
 
# if HAVE_SYS_TIME_H
84
 
#  include <sys/time.h>
85
 
# else
86
 
#  include <time.h>
87
 
# endif
88
 
#endif  
89
 
 
90
 
#include <drizzled/util/test.h>
91
 
 
92
79
bool thr_lock_inited=0;
93
80
uint32_t locks_immediate = 0L, locks_waited = 0L;
94
81
ulong table_lock_wait_timeout;
125
112
 
126
113
#ifdef EXTRA_DEBUG
127
114
#define MAX_FOUND_ERRORS        10              /* Report 10 first errors */
128
 
static uint32_t found_errors=0;
 
115
static uint found_errors=0;
129
116
 
130
117
static int check_lock(struct st_lock_list *list, const char* lock_type,
131
118
                      const char *where, bool same_owner, bool no_cond)
132
119
{
133
120
  THR_LOCK_DATA *data,**prev;
134
 
  uint32_t count=0;
 
121
  uint count=0;
135
122
  THR_LOCK_OWNER *first_owner;
136
123
 
137
124
  prev= &list->data;
190
177
static void check_locks(THR_LOCK *lock, const char *where,
191
178
                        bool allow_no_locks)
192
179
{
193
 
  uint32_t old_found_errors=found_errors;
 
180
  uint old_found_errors=found_errors;
194
181
 
195
182
  if (found_errors < MAX_FOUND_ERRORS)
196
183
  {
202
189
 
203
190
    if (found_errors < MAX_FOUND_ERRORS)
204
191
    {
205
 
      uint32_t count=0;
 
192
      uint count=0;
206
193
      THR_LOCK_DATA *data;
207
194
      for (data=lock->read.data ; data ; data=data->next)
208
195
      {
891
878
*/
892
879
 
893
880
 
894
 
#define LOCK_CMP(A,B) ((unsigned char*) (A->lock) - (uint) ((A)->type) < (unsigned char*) (B->lock)- (uint) ((B)->type))
 
881
#define LOCK_CMP(A,B) ((uchar*) (A->lock) - (uint) ((A)->type) < (uchar*) (B->lock)- (uint) ((B)->type))
895
882
 
896
 
static void sort_locks(THR_LOCK_DATA **data,uint32_t count)
 
883
static void sort_locks(THR_LOCK_DATA **data,uint count)
897
884
{
898
885
  THR_LOCK_DATA **pos,**end,**prev,*tmp;
899
886
 
915
902
 
916
903
 
917
904
enum enum_thr_lock_result
918
 
thr_multi_lock(THR_LOCK_DATA **data, uint32_t count, THR_LOCK_OWNER *owner)
 
905
thr_multi_lock(THR_LOCK_DATA **data, uint count, THR_LOCK_OWNER *owner)
919
906
{
920
907
  THR_LOCK_DATA **pos,**end;
921
908
  if (count > 1)
986
973
 
987
974
  /* free all locks */
988
975
 
989
 
void thr_multi_unlock(THR_LOCK_DATA **data,uint32_t count)
 
976
void thr_multi_unlock(THR_LOCK_DATA **data,uint count)
990
977
{
991
978
  THR_LOCK_DATA **pos,**end;
992
979
 
1220
1207
#ifdef MAIN
1221
1208
 
1222
1209
struct st_test {
1223
 
  uint32_t lock_nr;
 
1210
  uint lock_nr;
1224
1211
  enum thr_lock_type lock_type;
1225
1212
};
1226
1213
 
1269
1256
 
1270
1257
static pthread_cond_t COND_thread_count;
1271
1258
static pthread_mutex_t LOCK_thread_count;
1272
 
static uint32_t thread_count;
 
1259
static uint thread_count;
1273
1260
static uint32_t sum=0;
1274
1261
 
1275
1262
#define MAX_LOCK_COUNT 8
1344
1331
  thread_count--;
1345
1332
  pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
1346
1333
  pthread_mutex_unlock(&LOCK_thread_count);
1347
 
  free((unsigned char*) arg);
 
1334
  free((uchar*) arg);
1348
1335
  return 0;
1349
1336
}
1350
1337