Esempio n. 1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            File           f = new File();
            FileController c = new FileController(f);  // controls access to File f

            // start threads:
            new Thread(ReaderThread).Start(c);
            new Thread(WriterThread).Start(c);
            new Thread(WriterThread).Start(c);
            new Thread(IntruderThread).Start(c);
            // the main thread is still running:
            MessageBox.Show("System initiated.");
        }
Esempio n. 2
0
 public Intruder(FileController c)
 {
     this.c = c;
     InitializeComponent();
     button1.Text = "Make Trouble!";
 }
Esempio n. 3
0
        private Status state;     // STATE VARIABLE --- remembers if the form
        // is in act of reading the file

        public RForm(FileController c)
        {
            this.c = c;
            state  = Status.Closed;
            InitializeComponent();
        }
Esempio n. 4
0
        private Status state = Status.Closed; // STATE VARIABLE: remembers if form
        // is in process of writing file

        public WForm(FileController c)
        {
            this.c = c;
            InitializeComponent();
        }