Subj : Re: simple: passing a pointer to a handle to another thread To : comp.programming.threads From : Ulrich Eckhardt Date : Fri Sep 09 2005 08:30 am LeftHorn wrote: > i have a main() function where i creates a class. No, you don't, you create an instance of a class, an object. > then i have a thread, where when initiated i pass the pointer (in the > params) to this class (among other things). > > Inside this thread i i then access this object through a pointer, an > one of the functions is a function that returns a handle to a Semaphore. > > But when doing that - i get an error "access overrun" attempt to access > local block - when i have the class generated inside the thread, there > is no problem. Could you please post the whole error-message and when exactly it happens? Other than that, look at the pointer you want to pass into the thread function and the pointer that arrives there, are they equal? > How can i share a handle that isnt global among threads ? If something is intended to be thread-local, you probably shouldn't. I know that the MFC make some use of thread-local storage and because of that you can't use CWnd objects across threads. Uli .