Computer Chess Club Archives




Subject: Re: gcc / cygwin threads revisited

Author: Robert Hyatt

Date: 14:08:49 07/25/99

Go up one level in this thread

On July 25, 1999 at 16:26:34, James Swafford wrote:

>On July 25, 1999 at 13:45:36, Robert Hyatt wrote:
>>On July 24, 1999 at 17:19:31, James Swafford wrote:
>>5.  create a global/shared variable initialized to 0.  Whenever a thread notices
>>it is 1, they exit.  Then set this when needed...
>ui_thread_is_dead is already a global variable.  How
>is this different than "shared," and how do I designate
>it as shared?
>Under MSVC, *all* the global variables were shared, so
>if one thread modified a global, the other thread would
>see it.  That doesn't appear to be the case here.
>The program is designed in such a way that all the global
>variables are assumed to be shared between threads.  If this
>isn't the case when using fork( ), I could be in for some
>long nights. :-/  Is there a way to designate *all* globals
>as "shared?"  (Or am I still missing something here?)

I forgot to add, if you do have true shared-memory variables, they _must_
be declared volatile or the compiler will optimize you right out of the game.

This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.