Date: Wed, 16 Mar 2005 22:40:15 +0100 From: Peter Schuller <peter.schuller@infidyne.com> To: "Michael C. Shultz" <ringworm01@gmail.com> Cc: Zera William Holladay <zholla1@uic.edu> Subject: Re: threads question Message-ID: <20050316214014.GA88231@scode-whitestar.mine.nu> In-Reply-To: <200503151228.17719.ringworm01@gmail.com> References: <Pine.GSO.4.43.0503151312090.12075-100000@sea.ntplx.net> <200503151135.53269.ringworm01@gmail.com> <Pine.GSO.4.58.0503151349080.27785@icarus.cc.uic.edu> <200503151228.17719.ringworm01@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
>this works perfectly because I moved MGPMrUpgrade into >the same .c file so it would be a static function: > >structProperty* property; >pthread_t threads[NTHREADS]; >pthread_create( &threads[0], NULL, zzMGPMrUpgrade, property ); >When I use MGPMrUpgrade from a shared library the function runs >yet property isn't being passed! What do you mean by it not being passed? Does your function receive a NULL value for the parameter instead of the pointer? (Assuming no dirty tricks, the function would by definition always be passed *some* value, though it may be NULL.) > Hmmm, should I'll try making "property" global then passing a copy of it > to each thread? I think that will guarantee it stays valid. Since you are asking about makint it global - what is it *now*? It would have to be either global, dynamically allocated, or on the stack. If it's on the stack, things are guaranteed to blow up unless the function in question is guaranteed to not terminate untill all threads are done with the data. What is the property pointer being initialized/set to? If it's dynamically allocated you should not have a problem. And I don't see how static vs. dynamic linking of libraries should matter, but perhaps I am overlooking something. -- / Peter Schuller, InfiDyne Technologies HB PGP userID: 0xE9758B7D or 'Peter Schuller <peter.schuller@infidyne.com>' Key retrieval: Send an E-Mail to getpgpkey@scode.org E-Mail: peter.schuller@infidyne.com Web: http://www.scode.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050316214014.GA88231>