private void filewirter() { Boolean tempbool = false; Object lockingObject = ""; // Lock-Objecs //writing events lock (lockingObject) { //code //Console.WriteLine("writing events"); ThreadedFileWriteRead writeRead = new ThreadedFileWriteRead(); writeRead.writeEvents(eventsData, user); tempbool = true; Monitor.Pulse(lockingObject); } //writing contacts lock (lockingObject) { while (tempbool == false) //signaling condition { Monitor.Wait(lockingObject); //blocks until a notification is received form above method } //code //Console.WriteLine("writing contatcs"); ThreadedFileWriteRead writeRead = new ThreadedFileWriteRead(); writeRead.writeContacts(contactData, user); } }
private void fileread() { ThreadedFileWriteRead writeRead = new ThreadedFileWriteRead(); Console.WriteLine(user); Tuple <List <Event>, List <Contact> > returnedList = writeRead.fileReader(user); eventsData = returnedList.Item1; contactData = returnedList.Item2; }