PDA

View Full Version : Can you pass a pointer to something on to another thread?



Gadget
28-01-2004, 05:13 PM
I have a main exe that is creating a thread. I want to pass that thread a pointer to something, with the aim of the thread populating the object in the main exe. Is this possible? I mean, is a pointer valid within all memory space, or is the pointer specific to the memory space the exe uses?

Goliatus
28-01-2004, 05:34 PM
Do we have to test this? :wink:

Gadget
28-01-2004, 05:41 PM
Do we have this? :wink:


:?:

{MSX}
28-01-2004, 05:49 PM
I have a main exe that is creating a thread. I want to pass that thread a pointer to something, with the aim of the thread populating the object in the main exe. Is this possible? I mean, is a pointer valid within all memory space, or is the pointer specific to the memory space the exe uses?

Threads shares data memory. You can access your data structure with whatever thread you like, but you must sincronize the access to shared resources, using semaphore, mutex, critical section, event and other sincronization object.
You should read some tutorial or theory on thread and concurrency before implementing your code.

Gadget
29-01-2004, 06:51 AM
Thanks for that, reading up what I need to know now.