Re: Need for mutexes when reading global variables



On Sep 22, 7:29 pm, "lancer6...@xxxxxxxxx" <lancer6...@xxxxxxxxx>
wrote:
Is there a need to put a mutex around the reading of a global variable
that is initialized before any threads are created and remains
unchanged for the duration of the program, even though there is no
writes to it?

No mutex is needed for what you describe. pthread_create() is
required to synchronize memory, so any changes to global variables
made before calling it are guaranteed to be visible to the new thread.
http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_10


Philip Guenther
.



Relevant Pages

  • Re: How do I span a 50 hrs task throughout the 3 months of my proj
    ... supervisors can understand what the MS Project is!!! ... > totally different and the duration column will ALWAYS display duration, ... > Work field as a column next to the duration column and then your supervisor, ... Calling work duration or vice ...
    (microsoft.public.project)
  • Re: Duration of a media file
    ... > media types of the file I get it using IWMReader object and calling ... > GetOutputProps and GetMediaType but I can not get the duration using this ...
    (microsoft.public.win32.programmer.directx.audio)
  • Re: How do I span a 50 hrs task throughout the 3 months of my proj
    ... but duration and work are ... Work field as a column next to the duration column and then your supervisor, ... Calling work duration or vice ... Steve and James. ...
    (microsoft.public.project)
  • Re: GUI thread
    ... Jon Skeet [C# MVP] wrote: ... > duration of the dialog's visibility, but other than that, I don't know ... > calling Application.Run? ...
    (microsoft.public.dotnet.languages.csharp)