PDA

View Full Version : Threads...



Abc
17th June 2008, 12:30
How can I share resources between two threads in Linux??

I want two processes to be carried out simultaneously on two different threads but I need them to share the same window, the same status bar etc. How can I achieve this?

benacler
19th June 2008, 17:35
two processes or two threads ??? It isn't clear what you want to do...

To share items between threads, you've several ways. you can make your variables global or you can pass a pointer to a custom data struct when firying a new thread. In both cases, you have to protect the accesses to the data using locking functions like mutex,conditional variables and so on...not an easy discussion for a single thread...:)