@@ -2696,11 +2696,6 @@ namespace {
2696
2696
: dbb(d)
2697
2697
{ }
2698
2698
2699
- void waitForStartup ()
2700
- {
2701
- sem.enter ();
2702
- }
2703
-
2704
2699
static void runSweep (SweepParameter* par)
2705
2700
{
2706
2701
FbLocalStatus status;
@@ -2709,7 +2704,6 @@ namespace {
2709
2704
// reference is needed to guarantee that provider exists
2710
2705
// between semaphore release and attach database
2711
2706
AutoPlugin<JProvider> prov (JProvider::getInstance ());
2712
- par->sem .release ();
2713
2707
2714
2708
AutoDispose<IXpbBuilder> dpb (UtilInterfacePtr ()->getXpbBuilder (&status, IXpbBuilder::DPB, NULL , 0 ));
2715
2709
status.check ();
@@ -2733,14 +2727,26 @@ namespace {
2733
2727
ex.stuffException (&st);
2734
2728
if (st->getErrors ()[1 ] != isc_att_shutdown)
2735
2729
iscLogException (" Automatic sweep error" , ex);
2730
+
2731
+ if (dbb)
2732
+ {
2733
+ dbb->clearSweepStarting ();
2734
+ SPTHR_DEBUG (fprintf (stderr, " called clearSweepStarting() dbb=%p par=%p\n " , dbb, this ));
2735
+ dbb = NULL ;
2736
+ }
2737
+ }
2738
+
2739
+ static void cleanup (SweepParameter* par)
2740
+ {
2741
+ SPTHR_DEBUG (fprintf (stderr, " Cleanup dbb=%p par=%p\n " , par->dbb , par));
2742
+ delete par;
2736
2743
}
2737
2744
2738
2745
private:
2739
- Semaphore sem;
2740
2746
Database* dbb;
2741
2747
};
2742
2748
2743
- typedef ThreadFinishSync<SweepParameter*> SweepSync;
2749
+ typedef ThreadFinishSync<SweepParameter*, SweepParameter > SweepSync;
2744
2750
typedef HalfStaticArray<SweepSync*, 16 > SweepThreads;
2745
2751
InitInstance<SweepThreads> sweepThreads;
2746
2752
GlobalPtr<Mutex> swThrMutex;
@@ -2813,10 +2819,9 @@ static void start_sweeper(thread_db* tdbb)
2813
2819
}
2814
2820
2815
2821
AutoPtr<SweepSync> sweepSync (FB_NEW SweepSync (*getDefaultMemoryPool (), SweepParameter::runSweep));
2816
- SweepParameter swPar (dbb);
2817
- sweepSync->run (& swPar);
2822
+ SweepParameter* swPar = FB_NEW SweepParameter (dbb);
2823
+ sweepSync->run (swPar);
2818
2824
started = true ;
2819
- swPar.waitForStartup ();
2820
2825
sweepThreads ().add (sweepSync.release ());
2821
2826
}
2822
2827
catch (const Exception&)
0 commit comments