~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/thr_lock.h

  • Committer: Brian Aker
  • Date: 2010-09-15 20:24:31 UTC
  • mto: (1766.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1767.
  • Revision ID: brian@tangent.org-20100915202431-wbrrl4vg6rzjvdiu
Adding opt for optional schedulers and making them --plugin-add only.

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>
 
21
#include <pthread.h>
24
22
 
25
23
namespace drizzled
26
24
{
73
71
 
74
72
struct THR_LOCK_INFO
75
73
{
 
74
  pthread_t thread;
76
75
  uint64_t thread_id;
77
76
  uint32_t n_cursors;
78
77
 
79
78
  THR_LOCK_INFO() : 
 
79
    thread(0),
80
80
    thread_id(0),
81
81
    n_cursors(0)
82
82
  { }
108
108
  THR_LOCK_OWNER *owner;
109
109
  struct THR_LOCK_DATA *next,**prev;
110
110
  struct THR_LOCK *lock;
111
 
  boost::condition_variable_any *cond;
 
111
  pthread_cond_t *cond;
112
112
  enum thr_lock_type type;
113
113
  void *status_param;                   /* Param to status functions */
114
114
 
137
137
 
138
138
struct THR_LOCK {
139
139
private:
140
 
  boost::mutex mutex;
 
140
  pthread_mutex_t mutex;
141
141
public:
142
142
  struct st_lock_list read_wait;
143
143
  struct st_lock_list read;
160
160
 
161
161
  void lock()
162
162
  {
163
 
    mutex.lock();
 
163
    pthread_mutex_lock(&mutex);
164
164
  }
165
165
 
166
166
  void unlock()
167
167
  {
168
 
    mutex.unlock();
 
168
    pthread_mutex_unlock(&mutex);
169
169
  }
170
170
 
171
171
  void init()
172
172
  {
 
173
    pthread_mutex_init(&mutex, NULL);
173
174
  }
174
175
 
175
176
  void deinit()
176
177
  {
 
178
    pthread_mutex_destroy(&mutex);
177
179
  }
178
180
 
179
 
  boost::mutex *native_handle()
 
181
  pthread_mutex_t *native_handle()
180
182
  {
181
183
    return &mutex;
182
184
  }
183
185
};
184
186
 
185
 
class Session; 
186
187
 
187
188
#define thr_lock_owner_init(owner, info_arg) (owner)->info= (info_arg)
 
189
void thr_lock_info_init(THR_LOCK_INFO *info);
188
190
void thr_lock_init(THR_LOCK *lock);
189
 
enum enum_thr_lock_result thr_multi_lock(Session &session, THR_LOCK_DATA **data,
 
191
enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data,
190
192
                                         uint32_t count, THR_LOCK_OWNER *owner);
191
193
void thr_multi_unlock(THR_LOCK_DATA **data,uint32_t count);
192
194