コード例 #1
0
        public FixedArrayComboListEnumerator[] GetEnumerators(byte[] dlldata, string classname, string pluginsource)
        {
            ensureopen("GetEnumerators");
            ensurenotenumd("GetEnumerators");
            ensurewassortd("GetEnumerators");
            enumd = true;

            FixedArrayComboListEnumerator[] results;
            lock (dslaves)
            {
                int i;
                results = new FixedArrayComboListEnumerator[dslaves.Count];

                i = 0;
                foreach (SlaveInfo _slave in dslaves)
                {
                    BufSlaveInfo slave = (BufSlaveInfo)_slave;
                    lock (slave)
                    {
                        bool flushed = slave.FlushAddBuf_unlocked();
                        if (flushed)
                        {
                            slave.SlaveErrorCheck();
                        }
                    }
                    results[i]     = new FixedArrayComboListEnumerator(this, slave, dlldata, classname, pluginsource);
                    results[i].buf = this.buf; // Not needed, but fine.
                    i++;
                }
            }
            return(results);
        }
コード例 #2
0
        public void SortBlocks()
        {
            ensureopen("SortBlocks");
            ensurenotenumd("SortBlocks");
            sortd = true;

            // Enter all the locks...
            foreach (SlaveInfo slave in dslaves)
            {
                System.Threading.Monitor.Enter(slave); // !
            }
            try
            {
                // Sort all concurrently...
                foreach (SlaveInfo _slave in dslaves)
                {
                    BufSlaveInfo slave = (BufSlaveInfo)_slave;

                    //if (addbufinitsize > 0)
                    {
                        bool flushed = slave.FlushAddBuf_unlocked(); // !
                        if (flushed)
                        {
                            slave.SlaveErrorCheck();
                        }
                    }

                    slave.nstm.WriteByte((byte)'s'); // Sort.
                }
                // Wait for acks... (join!)
                foreach (SlaveInfo _slave in dslaves)
                {
                    BufSlaveInfo slave = (BufSlaveInfo)_slave;

                    if ((byte)'+' != slave.nstm.ReadByte())
                    {
                        slave.SlaveErrorCheck();
                        throw new Exception("SortBlocks error: sub process " + slave.slaveID.ToString() + " did not return a valid response");
                    }
                    slave.SlaveErrorCheck();
                }
            }
            finally
            {
                // Release all locks...
                foreach (SlaveInfo slave in dslaves)
                {
                    System.Threading.Monitor.Exit(slave); // !
                }
            }
        }
コード例 #3
0
ファイル: LongIntComboList.cs プロジェクト: xwyangjshb/qizmt
 public virtual void Flush()
 {
     if (addbufinitsize > 0)
     {
         foreach (SlaveInfo _slave in dslaves)
         {
             BufSlaveInfo slave = (BufSlaveInfo)_slave;
             lock (slave)
             {
                 slave.FlushAddBuf_unlocked();
             }
         }
     }
 }
コード例 #4
0
        public virtual void Flush()
        {
            ensureopen("Flush");
            ensurenotenumd("Flush");

            foreach (SlaveInfo _slave in dslaves)
            {
                BufSlaveInfo slave = (BufSlaveInfo)_slave;
                lock (slave)
                {
                    bool flushed = slave.FlushAddBuf_unlocked();
                    if (flushed)
                    {
                        slave.SlaveErrorCheck();
                    }
                }
            }
        }
コード例 #5
0
ファイル: LongIntComboList.cs プロジェクト: xwyangjshb/qizmt
        public virtual LongIntComboListEnumerator[] GetEnumerators()
        {
            if (!didopen)
            {
                throw new Exception("Attempted to GetEnumerators before Open");
            }

            LongIntComboListEnumerator[] results;
            lock (dslaves)
            {
                byte enumid = nextenumid;
                if (nextenumid >= 32)
                {
                    nextenumid = 0;
                }
                else
                {
                    nextenumid++;
                }

                int i;
                results = new LongIntComboListEnumerator[dslaves.Count];

                i = 0;
                foreach (SlaveInfo _slave in dslaves)
                {
                    BufSlaveInfo slave = (BufSlaveInfo)_slave;
                    if (addbufinitsize > 0)
                    {
                        lock (slave)
                        {
                            slave.FlushAddBuf_unlocked();
                        }
                    }
                    results[i]     = new LongIntComboListEnumerator(slave, enumid);
                    results[i].buf = this.buf; // Not needed, but fine.
                    i++;
                }
            }
            return(results);
        }