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."); }
public Intruder(FileController c) { this.c = c; InitializeComponent(); button1.Text = "Make Trouble!"; }
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(); }
private Status state = Status.Closed; // STATE VARIABLE: remembers if form // is in process of writing file public WForm(FileController c) { this.c = c; InitializeComponent(); }