I have a form. On button click, it should redirect to a dll wherein there are 2 classes.
Classxyz:
Has 2 threads.
Thread 1: should have the method that inserts a string into an array
Thread 2: should have the method that returns the first element from the array
Classarray:
The array is in a classarray.
My problem:
I am not able to understand if my threads are performing their tasks.
Class xyz:
public void ToDo(string str)
{
ThreadObject firstThreadObject = new ThreadObject();
firstThreadObject.str = str;
Thread firstThread = new Thread(DoWorkpeek);
firstThread.Start(firstThreadObject);
ThreadObject secondThreadObject = new ThreadObject();
secondThreadObject.str = str;
Thread secondThread = new Thread(DoWorkenque);
secondThread.Start(secondThreadObject);
firstThread.Abort();
secondThread.Abort();
}
public void DoWorkpeek(object parameter)
{
ThreadObject threadObject = parameter as ThreadObject;
str1 = objq.queuepeek(threadObject.str);
MessageBox.Show(str1);
}
public void DoWorkenque(object parameter)
{
ThreadObject threadObject = parameter as ThreadObject;
objq.enqueue(threadObject.str);
}
Is my code correct?
MessageBox.show(str1);
is not showing.