~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/query_id.cc

  • Committer: Brian Aker
  • Date: 2009-01-09 22:07:54 UTC
  • Revision ID: brian@tangent.org-20090109220754-1y50h7lqi9i1ifcs
Dead test/wrong test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
 
20
#include <drizzled/global.h>
21
21
#include <drizzled/definitions.h>
22
22
#include <drizzled/query_id.h>
23
 
#include "drizzled/internal/my_pthread.h"
24
 
 
25
 
namespace drizzled
26
 
{
27
 
 
28
 
Query_id::Query_id()
29
 
{
30
 
  the_query_id= 1;
 
23
#include <mysys/my_pthread.h>
 
24
 
 
25
Query_id::Query_id() : the_query_id(1)
 
26
{
 
27
  /* pthread_mutex_init always returns 0 */
 
28
  (void)pthread_mutex_init(&LOCK_query_id, MY_MUTEX_INIT_FAST);
31
29
}
32
30
 
33
31
Query_id::~Query_id()
34
32
{
 
33
  pthread_mutex_destroy(&LOCK_query_id);
35
34
}
36
35
 
37
 
uint64_t Query_id::value() const
 
36
query_id_t Query_id::value() const
38
37
{
39
38
  return the_query_id;
40
39
}
41
40
 
42
 
uint64_t Query_id::next()
 
41
query_id_t Query_id::next()
43
42
{
44
 
  uint64_t ret= the_query_id.increment();
45
 
 
 
43
  pthread_mutex_lock(&LOCK_query_id);
 
44
  query_id_t ret= the_query_id++;
 
45
  pthread_mutex_unlock(&LOCK_query_id);
46
46
  return ret;
47
47
}
48
48
 
49
 
} /* namespace drizzled */