コード例 #1
0
ファイル: LocalNodeInfo.cs プロジェクト: 3F/IeXod
        /// <summary>
        /// This method creates the shared memory buffers for communicating with the node
        /// </summary>
        /// <returns>Was the shared memory created and is useable</returns>
        internal bool CreateSharedMemoryBuffers()
        {
            this.sharedMemoryToNode =
                new SharedMemory
                (
                    LocalNodeProviderGlobalNames.NodeInputMemoryName(this.nodeNumber),
                    SharedMemoryType.WriteOnly,
                    false
                );

            if (!this.sharedMemoryToNode.IsUsable)
            {
                return(false);
            }


            this.sharedMemoryFromNode =
                new SharedMemory
                (
                    LocalNodeProviderGlobalNames.NodeOutputMemoryName(this.nodeNumber),
                    SharedMemoryType.ReadOnly,
                    false
                );

            if (!this.sharedMemoryFromNode.IsUsable)
            {
                return(false);
            }

            return(true);
        }
コード例 #2
0
ファイル: LocalNode.cs プロジェクト: 3F/IeXod
        /// <summary>
        /// This method causes the reader and writer threads to start and create the shared memory structures
        /// </summary>
        void StartCommunicationThreads()
        {
            // The writer thread should be created before the
            // reader thread because some LocalCallDescriptors
            // assume the shared memory for the writer thread
            // has already been created. The method will both
            // instantiate the shared memory for the writer
            // thread and also start the writer thread itself.
            // We will verifyThrow in the method if the
            // sharedMemory was not created correctly.
            engineCallback.StartWriterThread(nodeNumber);

            // Create the shared memory buffer
            this.sharedMemory =
                new SharedMemory
                (
                    // Generate the name for the shared memory region
                    LocalNodeProviderGlobalNames.NodeInputMemoryName(nodeNumber),
                    SharedMemoryType.ReadOnly,
                    // Reuse an existing shared memory region as it should have already
                    // been created by the parent node side
                    true
                );

            ErrorUtilities.VerifyThrow(this.sharedMemory.IsUsable,
                                       "Failed to create shared memory for local node input.");


            // Start the thread that will be processing the calls from the parent engine
            ThreadStart threadState = new ThreadStart(this.SharedMemoryReaderThread);

            readerThread      = new Thread(threadState);
            readerThread.Name = "MSBuild Child<-Parent Reader";
            readerThread.Start();
        }