| 671 | GlobalPtr<PluginsMap> plugins; |
| 672 | |
| 673 | void ConfiguredPlugin::destroy() |
| 674 | { |
| 675 | // plugins->mutex must be entered by current thread |
| 676 | |
| 677 | #ifdef DEV_BUILD |
| 678 | if (!plugins->mutex.tryEnter(FB_FUNCTION)) |
| 679 | fb_assert(false); |
| 680 | plugins->mutex.leave(); |
| 681 | #endif |
| 682 | if (!destroyingPluginsMap) |
| 683 | { |
| 684 | plugins->remove(MapKey(module->getPlugin(regPlugin).type, plugName)); |
| 685 | } |
| 686 | |
| 687 | fb_assert(!plugins->wakeIt); |
| 688 | if (module != builtin) |
| 689 | { |
| 690 | unsigned int type = module->getPlugin(regPlugin).type; |
| 691 | if (--(byTypeCounters->get(type).counter) == 0) |
| 692 | { |
| 693 | plugins->wakeIt = byTypeCounters->get(type).waitsOn; |
| 694 | } |
| 695 | } |
| 696 | #ifdef DEBUG_PLUGINS |
| 697 | fprintf(stderr, "~ConfiguredPlugin %s type %d\n", plugName.c_str(), module->getPlugin(regPlugin).type); |
| 698 | #endif |
| 699 | } |
| 700 | |
| 701 | typedef HalfStaticArray<ConfiguredPlugin*, 16> DelayedDelete; |
| 702 | static GlobalPtr<DelayedDelete> delayedDelete; |