~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbxt/src/myxt_xt.cc

  • Committer: lbieber
  • Date: 2010-09-23 01:31:43 UTC
  • mfrom: (1787.1.2 build)
  • Revision ID: lbieber@orisndriz08-20100923013143-z1fh9b7wdve6ha8s
Merge Paul - fix pbxt startup and shutdown
Merge Shrews - fix bug 644475 - Fix rabbitmq.variables test

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "xt_defs.h"
29
29
 
30
30
#ifdef DRIZZLED
 
31
#include <drizzled/internal/my_pthread.h>
31
32
#include <drizzled/plugin.h>
 
33
#include <drizzled/plugin/client.h>
 
34
#include <drizzled/plugin/null_client.h>
 
35
#include <drizzled/plugin/listen.h>
32
36
#include <drizzled/show.h>
33
37
#include <drizzled/data_home.h>
34
38
#include <drizzled/field/blob.h>
3062
3066
xtPublic void *myxt_create_thread()
3063
3067
{
3064
3068
#ifdef DRIZZLED
3065
 
        return (void *) 1;
 
3069
        Client          *client;
 
3070
        Session         *session;
 
3071
 
 
3072
        if (drizzled::internal::my_thread_init()) {
 
3073
                xt_register_error(XT_REG_CONTEXT, XT_ERR_MYSQL_ERROR, 0, "Unable to initialize MySQL threading");
 
3074
                return NULL;
 
3075
        }
 
3076
 
 
3077
        if (!(client = new NullClient()))
 
3078
                return NULL;
 
3079
        session = new Session(client);
 
3080
        session->thread_stack = (char *) &session;
 
3081
        session->storeGlobals();
 
3082
        return (void *) session;
3066
3083
#else
3067
3084
        THD *new_thd;
3068
3085
 
3140
3157
}
3141
3158
 
3142
3159
#ifdef DRIZZLED
3143
 
xtPublic void myxt_destroy_thread(void *, xtBool)
3144
 
{
3145
 
}
3146
 
 
3147
 
xtPublic void myxt_delete_remaining_thread()
3148
 
{
 
3160
xtPublic void myxt_destroy_thread(void *s, xtBool end_threads)
 
3161
{
 
3162
        Session *session = (Session *) s;
 
3163
 
 
3164
        session->lockForDelete();
 
3165
        delete session;
 
3166
 
 
3167
        if (end_threads)
 
3168
                drizzled::internal::my_thread_end();
3149
3169
}
3150
3170
#else
3151
3171
xtPublic void myxt_destroy_thread(void *thread, xtBool end_threads)
3174
3194
        if (end_threads)
3175
3195
                my_thread_end();
3176
3196
}
 
3197
#endif
3177
3198
 
3178
3199
xtPublic void myxt_delete_remaining_thread()
3179
3200
{
3182
3203
        if ((thd = current_thd))
3183
3204
                myxt_destroy_thread((void *) thd, TRUE);
3184
3205
}
3185
 
#endif
3186
3206
 
3187
3207
xtPublic XTThreadPtr myxt_get_self()
3188
3208
{