~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to include/thr_lock.h

  • Committer: Monty Taylor
  • Date: 2008-07-02 14:35:48 UTC
  • mto: This revision was merged to the branch mainline in revision 51.
  • Revision ID: monty@inaugust.com-20080702143548-onj30ry0sugr01uw
Removed all references to THREAD.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
extern "C" {
22
22
#endif
23
23
 
24
 
#include <mysys/my_pthread.h>
25
 
#include <mysys/my_list.h>
 
24
#include <my_pthread.h>
 
25
#include <my_list.h>
26
26
 
27
27
struct st_thr_lock;
28
 
extern uint32_t locks_immediate,locks_waited ;
29
 
extern pthread_mutex_t THR_LOCK_lock;
 
28
extern ulong locks_immediate,locks_waited ;
30
29
 
31
30
enum thr_lock_type { TL_IGNORE=-1,
32
31
                     TL_UNLOCK,                 /* UNLOCK ANY LOCK */
73
72
 
74
73
extern ulong max_write_lock_count;
75
74
extern ulong table_lock_wait_timeout;
76
 
extern bool thr_lock_inited;
 
75
extern my_bool thr_lock_inited;
77
76
extern enum thr_lock_type thr_upgraded_concurrent_insert_lock;
78
77
 
79
78
/*
85
84
{
86
85
  pthread_t thread;
87
86
  my_thread_id thread_id;
88
 
  uint32_t n_cursors;
 
87
  ulong n_cursors;
89
88
} THR_LOCK_INFO;
90
89
 
91
90
/*
107
106
  pthread_cond_t *cond;
108
107
  enum thr_lock_type type;
109
108
  void *status_param;                   /* Param to status functions */
 
109
  void *debug_print_param;
110
110
} THR_LOCK_DATA;
111
111
 
112
112
struct st_lock_list {
121
121
  struct st_lock_list write_wait;
122
122
  struct st_lock_list write;
123
123
  /* write_lock_count is incremented for write locks and reset on read locks */
124
 
  uint32_t write_lock_count;
125
 
  uint32_t read_no_write_count;
 
124
  ulong write_lock_count;
 
125
  uint read_no_write_count;
126
126
  void (*get_status)(void*, int);       /* When one gets a lock */
127
127
  void (*copy_status)(void*,void*);
128
128
  void (*update_status)(void*);         /* Before release of write */
129
129
  void (*restore_status)(void*);         /* Before release of read */
130
 
  bool (*check_status)(void *);
 
130
  my_bool (*check_status)(void *);
131
131
} THR_LOCK;
132
132
 
133
133
 
134
134
extern LIST *thr_lock_thread_list;
 
135
extern pthread_mutex_t THR_LOCK_lock;
135
136
 
136
 
bool init_thr_lock(void);               /* Must be called once/thread */
 
137
my_bool init_thr_lock(void);            /* Must be called once/thread */
137
138
#define thr_lock_owner_init(owner, info_arg) (owner)->info= (info_arg)
138
139
void thr_lock_info_init(THR_LOCK_INFO *info);
139
140
void thr_lock_init(THR_LOCK *lock);
145
146
                                   enum thr_lock_type lock_type);
146
147
void thr_unlock(THR_LOCK_DATA *data);
147
148
enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data,
148
 
                                         uint32_t count, THR_LOCK_OWNER *owner);
149
 
void thr_multi_unlock(THR_LOCK_DATA **data,uint32_t count);
150
 
void thr_abort_locks(THR_LOCK *lock, bool upgrade_lock);
151
 
bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread);
152
 
bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data);
 
149
                                         uint count, THR_LOCK_OWNER *owner);
 
150
void thr_multi_unlock(THR_LOCK_DATA **data,uint count);
 
151
void thr_abort_locks(THR_LOCK *lock, my_bool upgrade_lock);
 
152
my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread);
 
153
void thr_print_locks(void);             /* For debugging */
 
154
my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data);
153
155
void    thr_downgrade_write_lock(THR_LOCK_DATA *data,
154
156
                                 enum thr_lock_type new_lock_type);
155
 
bool thr_reschedule_write_lock(THR_LOCK_DATA *data);
 
157
my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data);
156
158
#ifdef  __cplusplus
157
159
}
158
160
#endif