~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_plugin.cc

  • Committer: Brian Aker
  • Date: 2009-01-24 04:31:39 UTC
  • Revision ID: brian@gir-3.local-20090124043139-5cu9wjefszrnyhe0
Refactored all current scheduler to be behind scheduler plugin api.

Show diffs side-by-side

added added

removed removed

Lines of Context:
874
874
int plugin_init(int *argc, char **argv, int flags)
875
875
{
876
876
  uint32_t idx;
 
877
  uint32_t number_of_schedulers= 0; /* We must insist that only one of these plugins get loaded at a time */
877
878
  struct st_mysql_plugin **builtins;
878
879
  struct st_mysql_plugin *plugin;
879
880
  struct st_plugin_int tmp, *plugin_ptr;
912
913
  {
913
914
    for (plugin= *builtins; plugin->name; plugin++)
914
915
    {
 
916
      if (plugin->type == DRIZZLE_SCHEDULING_PLUGIN)
 
917
        number_of_schedulers++;
 
918
 
915
919
      memset(&tmp, 0, sizeof(tmp));
916
920
      tmp.plugin= plugin;
917
921
      tmp.name.str= (char *)plugin->name;
962
966
    plugin_ptr= *dynamic_element(&plugin_array, idx, struct st_plugin_int **);
963
967
    if (plugin_ptr->state == PLUGIN_IS_UNINITIALIZED)
964
968
    {
 
969
      if (plugin_ptr->plugin->type == DRIZZLE_SCHEDULING_PLUGIN)
 
970
        number_of_schedulers++;
 
971
 
965
972
      if (plugin_initialize(plugin_ptr))
966
973
      {
967
974
        plugin_ptr->state= PLUGIN_IS_DYING;
971
978
    }
972
979
  }
973
980
 
 
981
  if (number_of_schedulers == 0)
 
982
  {
 
983
    fprintf(stderr, "You must load at least one scheduler plugin\n");
 
984
    exit(1);
 
985
  }
 
986
  else if (number_of_schedulers > 1)
 
987
  {
 
988
    fprintf(stderr, "You can not load more then one scheduler plugin\n");
 
989
    exit(1);
 
990
  }
 
991
 
974
992
 
975
993
end:
976
994
  free_root(&tmp_root, MYF(0));