~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/thr_lock.h

  • Committer: Patrick Crews
  • Date: 2010-09-14 20:21:03 UTC
  • mto: (1771.1.1 pcrews)
  • mto: This revision was merged to the branch mainline in revision 1772.
  • Revision ID: gleebix@gmail.com-20100914202103-1db2n0bshzafep19
Moved transaction_log tests into updated non-publisher-based tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/* For use with thr_locks */
17
17
 
18
18
#ifndef DRIZZLED_THR_LOCK_H
19
19
#define DRIZZLED_THR_LOCK_H
20
20
 
21
 
#include <boost/thread/mutex.hpp>
22
 
#include <boost/thread/shared_mutex.hpp>
23
 
#include <boost/thread/condition_variable.hpp>
24
 
 
25
 
#include "drizzled/visibility.h"
 
21
#include <pthread.h>
26
22
 
27
23
namespace drizzled
28
24
{
75
71
 
76
72
struct THR_LOCK_INFO
77
73
{
 
74
  pthread_t thread;
78
75
  uint64_t thread_id;
79
76
  uint32_t n_cursors;
80
77
 
81
78
  THR_LOCK_INFO() : 
 
79
    thread(0),
82
80
    thread_id(0),
83
81
    n_cursors(0)
84
82
  { }
106
104
struct THR_LOCK;
107
105
struct THR_LOCK_DATA;
108
106
 
109
 
struct DRIZZLED_API THR_LOCK_DATA {
 
107
struct THR_LOCK_DATA {
110
108
  THR_LOCK_OWNER *owner;
111
109
  struct THR_LOCK_DATA *next,**prev;
112
110
  struct THR_LOCK *lock;
113
 
  boost::condition_variable_any *cond;
 
111
  pthread_cond_t *cond;
114
112
  enum thr_lock_type type;
115
113
  void *status_param;                   /* Param to status functions */
116
114
 
139
137
 
140
138
struct THR_LOCK {
141
139
private:
142
 
  boost::mutex mutex;
 
140
  pthread_mutex_t mutex;
143
141
public:
144
142
  struct st_lock_list read_wait;
145
143
  struct st_lock_list read;
162
160
 
163
161
  void lock()
164
162
  {
165
 
    mutex.lock();
 
163
    pthread_mutex_lock(&mutex);
166
164
  }
167
165
 
168
166
  void unlock()
169
167
  {
170
 
    mutex.unlock();
 
168
    pthread_mutex_unlock(&mutex);
171
169
  }
172
170
 
173
171
  void init()
174
172
  {
 
173
    pthread_mutex_init(&mutex, NULL);
175
174
  }
176
175
 
177
176
  void deinit()
178
177
  {
 
178
    pthread_mutex_destroy(&mutex);
179
179
  }
180
180
 
181
 
  boost::mutex *native_handle()
 
181
  pthread_mutex_t *native_handle()
182
182
  {
183
183
    return &mutex;
184
184
  }
185
185
};
186
186
 
187
 
class Session; 
188
187
 
189
188
#define thr_lock_owner_init(owner, info_arg) (owner)->info= (info_arg)
190
 
DRIZZLED_API void thr_lock_init(THR_LOCK *lock);
191
 
enum enum_thr_lock_result thr_multi_lock(Session &session, THR_LOCK_DATA **data,
 
189
void thr_lock_info_init(THR_LOCK_INFO *info);
 
190
void thr_lock_init(THR_LOCK *lock);
 
191
enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data,
192
192
                                         uint32_t count, THR_LOCK_OWNER *owner);
193
193
void thr_multi_unlock(THR_LOCK_DATA **data,uint32_t count);
194
194