June 1st, 1999, 05:34 PM
Greetings!
I have a listview app, that displays student data. Each student has an item in the view associated with that student, of which the unique studno is the first column in the view. The actual student data is kept in a student array in the Document class, adhering to the Doc/View paradigm.
Now I have two (or more) threads of which the main thread is the GUI thread, while the other(s) are worker thread(s). The student array is obviously a shared resource, and care must be taken not to have multiple threads accessing it at the same time. But that's relatively straight forward. My problem is that how do I, inside a worker thread, modify the student array, AND the related listview item in the view? Can/should a worker thread modify a view? Isn't that the job of the main (GUI) thread? But how do I sync the two? I don't know how to go about updating the data (array of students) and the listview item(s) that are representative of those students inside a thread other than the main thread. You're probably asking, why I have to do it inside a thread...I mean what's the need for the threads anyway? Well I need this to work before I tackle the original problem, which is quite similiar.
If anyone has any ideas or guidelines - plz let me know.
Thanks in advance.
I have a listview app, that displays student data. Each student has an item in the view associated with that student, of which the unique studno is the first column in the view. The actual student data is kept in a student array in the Document class, adhering to the Doc/View paradigm.
Now I have two (or more) threads of which the main thread is the GUI thread, while the other(s) are worker thread(s). The student array is obviously a shared resource, and care must be taken not to have multiple threads accessing it at the same time. But that's relatively straight forward. My problem is that how do I, inside a worker thread, modify the student array, AND the related listview item in the view? Can/should a worker thread modify a view? Isn't that the job of the main (GUI) thread? But how do I sync the two? I don't know how to go about updating the data (array of students) and the listview item(s) that are representative of those students inside a thread other than the main thread. You're probably asking, why I have to do it inside a thread...I mean what's the need for the threads anyway? Well I need this to work before I tackle the original problem, which is quite similiar.
If anyone has any ideas or guidelines - plz let me know.
Thanks in advance.