/*----< kill all child processes in the pool >-----------------*/

        bool shutdownPool()
        {
            for (int i = 0; i < childs_.Count; i++)
            {
                // kill process
                Console.Write("\n  kill child process: " + (i + 1));
                childs_[i].process.Kill();
            }
            childs_.Clear();
            readyQ_.clear();
            return(true);
        }
Exemple #2
0
        private void shutdownProcessPool(CommMessage msg)
        {
            //open = false;
            for (int i = 0; i < allProcessinPool.Count; i++)
            {
                try
                {
                    int proIndex = allProcessinPool[i].processUID;
                    int procId   = allProcessinPool[i].process.Id;
                    allProcessinPool[i].process.Kill( );
                    //allProcessinPool[ i ].process.CloseMainWindow ( );
                    //allProcessinPool[ i ].process.Close ( );
                    //allProcessinPool[ i ].process.Dispose ( );
                    Console.Write("\n  shutdown ChildBuilder Process : {0} on id {1}", proIndex, procId);
                }
                catch (Exception ex)
                {
                    Console.Write("\n {0}", ex.Message);
                }
            }

            readQ.clear( );
            requestedQ.clear( );
            allProcessinPool.Clear( );


            //return message to client
            CommMessage returnMsg = new CommMessage(CommMessage.MessageType.reply);

            returnMsg.to       = msg.from;
            returnMsg.from     = msg.to;
            returnMsg.command  = msg.command;
            returnMsg.author   = "BuildServer";
            returnMsg.argument = "Succeed shutdown process pool . ";
            comm.postMessage(returnMsg);
        }