Пример #1
0
        public static void DMInit(object objectParameters)
        {
            moduleControlDataBlock
                = (ModuleControlDataBlock)objectParameters;
            threadParameters = moduleControlDataBlock.ThreadParameters;

            try
            {
                // Initialize Ready/Abort Event and threadpool
                ModuleReadyEvent = threadParameters.ModuleReadyEvent;
                ModuleAbortEvent = threadParameters.ModuleAbortEvent;
                moduleThreadPool = threadParameters.moduleThreadPool;
                ModuleReadyEvent.Set();

                Debug.WriteLine("DMInit complete Phase 1 Initialization");

                // Wait for core StartWork Signal
                ModuleStartWorkEvent = threadParameters.ModuleStartWorkEvent;
                ModuleStartWorkEvent.WaitOne();

                Debug.WriteLine("DMInit complete Phase 2 Initialization");

                //
                // Main Thread of DM module (begin)
                //
                // Initialize dictionary manager
                recordDictionaryManager = new RecordDictionaryManager();

                // Whenever the SaveRecord Event is called, DMSavingRecordWrapper
                // will be called
                RecordSavingTriggerd += new SaveRecordEventHanlder(
                    DMSavingRecordWrapper);


                Debug.WriteLine("DM module is working...");

                // Check ModuleAbortEvent periodically
                while (!ModuleAbortEvent
                       .WaitOne((int)TimeInterval.VeryVeryShortTime))
                {
                    // Does nothing and wait for abort event
                }

                Debug.WriteLine("DM module is aborting.");
                CleanupExit();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine("DM module thread failed.");
                threadParameters.ModuleInitFailedEvent.Set();
                Debug.WriteLine("DM ModuleInitFailedEvent Set");
                CleanupExit();
            }
        }
Пример #2
0
        public static void RTQCInit(object objectParameters)
        {
            moduleControlDataBlock
                = (ModuleControlDataBlock)objectParameters;
            threadParameters = moduleControlDataBlock.ThreadParameters;

            try
            {
                // Initialize ready/abort event and threadpool
                ModuleReadyEvent = threadParameters.ModuleReadyEvent;
                ModuleAbortEvent = threadParameters.ModuleAbortEvent;
                moduleThreadPool = threadParameters.moduleThreadPool;
                ModuleReadyEvent.Set();

                Debug.WriteLine("RTQCInit complete Phase 1 Initialization");

                // Wait for Core StartWorkEvent Signal
                ModuleStartWorkEvent = threadParameters.ModuleStartWorkEvent;
                ModuleStartWorkEvent.WaitOne();

                Debug.WriteLine("RTQCInit complete Phase 2 Initialization");

                //
                // Main Thread of RTQC module (begin)
                //
                Debug.WriteLine("RTQC module is working...");

                // Whenever ValidateEvent is raised, RTQCValidateWrapper will
                // be called.
                ValidateEventTriggerd += new ValidateEventHanlder(
                    RTQCValidateWrapper);

                // Check ModuleAbortEvent periodically
                while (!ModuleAbortEvent
                       .WaitOne((int)TimeInterval.VeryVeryShortTime))
                {
                }

                Debug.WriteLine("RTQC module is aborting.");
                CleanupExit();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine("RTQC module thread failed.");
                threadParameters.ModuleInitFailedEvent.Set();
                Debug.WriteLine("RTQC ModuleInitFailedEvent Set");
                CleanupExit();
            }
        }
Пример #3
0
        /// <summary>
        /// DR module initialization
        /// </summary>
        /// <param name="objectParameters"></param>
        public static void DRInit(object objectParameters)
        {
            moduleControlDataBlock
                = (ModuleControlDataBlock)objectParameters;
            threadParameters = moduleControlDataBlock.ThreadParameters;

            try
            {
                // Initialize Ready/Abort Event and threadpool
                ModuleReadyEvent = threadParameters.ModuleReadyEvent;
                ModuleAbortEvent = threadParameters.ModuleAbortEvent;

                // Set the socket configuration
                ServerSocket = new Socket(AddressFamily.InterNetwork,
                                          SocketType.Stream, ProtocolType.Tcp);
                receiveEvent = new ReceiveEvent();
                ModuleReadyEvent.Set();
                ReceiveWorkThread = new Thread(ReceiveWork);

                Log.GeneralEvent
                .Write("DRInit complete Phase 1 Initialization");

                // Wait for core StartWork Signal
                ModuleStartWorkEvent = threadParameters.ModuleStartWorkEvent;
                ModuleStartWorkEvent.WaitOne();

                Log.GeneralEvent
                .Write("DRInit complete Phase 2 Initialization");

                ReceiveWorkThread.Start();
                Log.GeneralEvent.Write("DR module is working...");

                // Check ModuleAbortEvent periodically
                SpinWait.SpinUntil(() => !ModuleAbortEvent
                                   .WaitOne((int)TimeInterval.VeryVeryShortTime));

                Log.GeneralEvent.Write("DR module is aborting.");
            }
            catch (Exception ex)
            {
                Log.ErrorEvent.Write(ex.Message);
                Log.ErrorEvent.Write("DR module thread failed.");
                threadParameters.ModuleInitFailedEvent.Set();
                Log.ErrorEvent.Write("DR ModuleInitFailedEvent Set");
            }

            CleanupExit();
        }
Пример #4
0
        public static void DSInit(object objectParameters)
        {
            moduleControlDataBlock
                = (ModuleControlDataBlock)objectParameters;
            threadParameters = moduleControlDataBlock.ThreadParameters;
            //moduleWorkQueue = moduleControlDataBlock.ModuleWorkQueue;

            try
            {
                //Initialize ready/abort event
                ModuleReadyEvent = threadParameters.ModuleReadyEvent;
                ModuleAbortEvent = threadParameters.ModuleAbortEvent;
                moduleThreadPool = threadParameters.moduleThreadPool;

                ModuleReadyEvent.Set();

                Debug.WriteLine("DSInit complete Phase 1 Initialization");

                //Wait for startwork signal
                ModuleStartWorkEvent = threadParameters.ModuleStartWorkEvent;
                ModuleStartWorkEvent.WaitOne();

                Debug.WriteLine("DSInit complete Phase 2 Initialization");

                //
                // Main Thread of DS module (begin)
                //
                Debug.WriteLine("DS module is working...");
                Debug.WriteLine("DS Core: " + Thread.CurrentThread.ManagedThreadId);
                // Check ModuleAbortEvent periodically
                while (!ModuleAbortEvent
                       .WaitOne((int)TimeInterval.VeryVeryShortTime))
                {
                    //Does nothing
                }

                Debug.WriteLine("DS module is aborting.");
                CleanupExit();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine("DS module thread failed.");
                threadParameters.ModuleInitFailedEvent.Set();
                Debug.WriteLine("DS ModuleInitFailedEvent Set");
                CleanupExit();
            }
        }
Пример #5
0
        public static void MANInit(object objectParameters)
        {
            moduleControlDataBlock
                = (ModuleControlDataBlock)objectParameters;
            threadParameters = moduleControlDataBlock.ThreadParameters;

            try
            {
                // Initialize ready/abort event
                ModuleReadyEvent = threadParameters.ModuleReadyEvent;
                ModuleAbortEvent = threadParameters.ModuleAbortEvent;
                moduleThreadPool = threadParameters.moduleThreadPool;
                builder          = new Notification.Builder();
                ModuleReadyEvent.Set();

                Debug.WriteLine("MANInit complete Phase 1 Initialization");

                // Wait for starwork signal
                ModuleStartWorkEvent = threadParameters.ModuleStartWorkEvent;
                ModuleStartWorkEvent.WaitOne();

                Debug.WriteLine("MANInit complete Phase 2 Initialization");

                //
                // Main Thread of MAN module (begin)
                //

                Debug.WriteLine("MAN module is working...");

                // Check ModuleAbortEvent periodically
                while (!ModuleAbortEvent
                       .WaitOne((int)TimeInterval.VeryVeryShortTime))
                {
                }

                Debug.WriteLine("MAN module is aborting.");
                CleanupExit();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine("MAN module thread failed.");
                threadParameters.ModuleInitFailedEvent.Set();
                Debug.WriteLine("MAN ModuleInitFailedEvent Set");
                CleanupExit();
            }
        }