示例#1
0
        public void Write(String cad, MutexAction action = MutexAction.NONE)
        {
            if (action == MutexAction.ADQUIRE || action == MutexAction.ATOMIC)
            {
                mutex.WaitOne();
            }

            this.output.Write(cad);

            if (action == MutexAction.RELAX || action == MutexAction.ATOMIC)
            {
                mutex.ReleaseMutex();
            }
        }
示例#2
0
        public String ReadLine(MutexAction action = MutexAction.NONE)
        {
            String cad;

            if (action == MutexAction.ADQUIRE || action == MutexAction.ATOMIC)
            {
                mutex.WaitOne();
            }

            cad = this.input.ReadLine();

            if (action == MutexAction.RELAX || action == MutexAction.ATOMIC)
            {
                mutex.ReleaseMutex();
            }

            return(cad);
        }
示例#3
0
        public String ReadWord(MutexAction action = MutexAction.NONE)
        {
            if (ind < 0 || ind == words.Length)
            {
                ind   = -1;
                line  = this.ReadLine(action);
                words = line.Split(new char[1] {
                    ' '
                }, StringSplitOptions.RemoveEmptyEntries);
            }

            ind++;
            if (ind < words.Length)
            {
                return(words[ind]);
            }

            return("");
        }
示例#4
0
 public void WriteLine(String cad, MutexAction action = MutexAction.NONE)
 {
     Write(cad + Types.newline, action);
 }