PDA

View Full Version : how to pass data ie (from main thread which have dialog ) to another thread



gauravg
28th March 2012, 14:01
hi
all please tell how to pass data which is main thread(a GUI thread) to another thread which process that data
return the result to main thread. suppose i have a dialog which have to field that data is transfer to another thread which process that return result to dialog which is in main thread.

please guide me with some lines of code.



thanks with regards:
gauravg

amleto
28th March 2012, 18:58
Do you want to pass this data as a reference? ie do you want the dialog and the other thread to both be able to change the same data?

If not, just make a copy and pass the copy to the thread. Then you have no headaches about mutexes etc.

Otherwise, use pointers and mutexes.