Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        internal void StartWriterThread(int nodeNumber)
        {
            this.writerThreadHasExited = false;

            this.sharedMemory =
                new SharedMemory
                (
                    LocalNodeProviderGlobalNames.NodeOutputMemoryName(nodeNumber),
                    SharedMemoryType.WriteOnly,
                    true
                );

            ErrorUtilities.VerifyThrow(this.sharedMemory.IsUsable,
                                       "Failed to create shared memory for engine callback.");

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

            writerThread      = new Thread(threadState);
            writerThread.Name = "MSBuild Child->Parent Writer";
            writerThread.Start();
        }