Exemplo n.º 1
0
        public AnalyzerHandler(double theTicSizeInSeconds, LMLoggers.LognLM logger)
        {

            ticSizeInSeconds = theTicSizeInSeconds;
            log = logger;
            verboseTrace = log.ShouldTrace(LogLevels.Verbose);
            numNeutronEventsReceived = 0;
            numNeutronEventsReceivedWhetherProcessedOrNot = 0;
            numNeutronEventsCompleted = 0;
            numCircuits = 0;
            timeOfLastNeutronEvent = 0;
            if (ticSizeInSeconds == 1e-7)
            {
                timeBaseConversion = 1ul;  // no external to internal conversion
            }
            else if (ticSizeInSeconds == 1e-8)
            {
                timeBaseConversion = 10ul; // shift gate units from tics (1e-7) to shakes (1e-8)
            }

#if USE_SPINTIME
            ResetSpinTime();
#endif
            //create stack of RawAnalysisProperties.circularListBlockIncrement neutron events, as a starting point
            InitializeEventList();

            permissionToUseEndOfEvents = new SemaphoreSlim(1, 1); // LMKV-52 fix: create here with counter set at 1 and only 1 thread

            //set up the AH BackgroundWorker
            AHWorkerStopNow = false;
            AHWorkerHasCompleted = false;
            AHWorkerStopAtEndOfEvents = false;
            AHWorker = new BackgroundWorker();
            AHWorker.WorkerSupportsCancellation = false;  //parent will stop the worker with the boolean flags
            AHWorker.DoWork += new DoWorkEventHandler(AHWorkerDoWork);
            AHWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(AHWorkerRunWorkerCompleted);
            AHWorker.RunWorkerAsync();

            // permissionToUseEndOfEventsRelease();  // LMKV-52 fix: allow 1 thread at a time now that bkg worker started
            //pause until the AHWorker is working...
            while (AHWorker.IsBusy == false)
            {
                //spin
            }

            log.TraceEvent(LogLevels.Verbose, (int)AnalyzerEventCode.AnalyzerHandlerEvent, "AnalyzerHandler constructor started its thread.");
        }
Exemplo n.º 2
0
        public AnalyzerHandler(double theTicSizeInSeconds, LMLoggers.LognLM logger)
        {
            TickSizeInSeconds = theTicSizeInSeconds;
            log = logger;
            verboseTrace = log.ShouldTrace(LogLevels.Verbose);
            InitCounters();

            #if USE_SPINTIME
            ResetSpinTime();
            #endif
            //create stack of RawAnalysisProperties.circularListBlockIncrement neutron events, as a starting point
            //InitializeEventList(RawAnalysisProperties.circularListBlockIncrement);

            permissionToUseEndOfEvents = new SemaphoreSlim(1, 1); // LMKV-52 fix: create here with counter set at 1 and only 1 thread

            //set up the AH BackgroundWorker
            AHWorkerStopNow = false;
            AHWorkerHasCompleted = false;
            AHWorkerStopAtEndOfEvents = false;
            AHWorker = new BackgroundWorker();
            AHWorker.WorkerSupportsCancellation = false;  //parent will stop the worker with the boolean flags
            AHWorker.DoWork += new DoWorkEventHandler(AHWorkerDoWork);
            AHWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(AHWorkerRunWorkerCompleted);
            AHWorker.RunWorkerAsync();

            // permissionToUseEndOfEventsRelease();  // LMKV-52 fix: allow 1 thread at a time now that bkg worker started
            //pause until the AHWorker is working...
            while (AHWorker.IsBusy == false)
            {
                //spin
            }

            log.TraceEvent(LogLevels.Verbose, (int)AnalyzerEventCode.AnalyzerHandlerEvent, "AnalyzerHandler constructor started its thread.");
        }