4ea Subj : Re: a thread question To : comp.programming.threads From : Chris Thomasson Date : Thu May 12 2005 07:07 pm >> How could thread_c modify and/or read a_local and/or b_local "without" >> deliberately passing a pointer or corrupting anything? > > If you're asking how can it happen accidentally, the answer is of > course through some bug that causes thread_c to happen to hit the address > of a_local or b_local. You can only not do something deliberately through > a bug. However, if you want other threads to access it, it's not difficult > to set up. OK. I think I misunderstood you. You are correct in saying that all threads can see every variable though there address. > As for "corrupting anything", what are you talking about? thread_c can corrupt memory and alter a/b_local's value. > Threads are supposed to share variables -- that's the whole point of them. Well, there is the concept of thread-local ( unshared ) variables... I generally try to keep all of my variables filed under two main categories: 1. thread-local address only visible to the single thread that owns the variable. 2. shared address can be visible to a variable number of different threads. . 0