Multi-Thread public variables...

Discussion in 'C++' started by fachero1@yahoo.com, Sep 1, 2006.

  1. Guest

    How Can I set a public global variable whos value can be accessed by
    any thread? not just by one thread but by all?...

    Currently from what I see and understand if a thread is created the
    global variable becomes locked or something like that...

    how can I do this? in my case this would be totally safe to do ^.^
    thanks
    Jonathan
     
    , Sep 1, 2006
    #1
    1. Advertising

  2. wrote:
    > How Can I set a public global variable whos value can be accessed by
    > any thread? not just by one thread but by all?...


    (a) Threads are off-topic. Try comp.programming.threads.

    (b) Global variables are usually accessible by all threads. There is
    nothing you need to do different from just defining it/them.

    > Currently from what I see and understand if a thread is created the
    > global variable becomes locked or something like that...


    Unknown in C++. Not topical.

    > how can I do this? in my case this would be totally safe to do ^.^


    Try asking in comp.programming.threads.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Sep 1, 2006
    #2
    1. Advertising

  3. Jim Langston Guest

    <> wrote in message
    news:...
    > How Can I set a public global variable whos value can be accessed by
    > any thread? not just by one thread but by all?...
    >
    > Currently from what I see and understand if a thread is created the
    > global variable becomes locked or something like that...
    >
    > how can I do this? in my case this would be totally safe to do ^.^
    > thanks
    > Jonathan


    Two things:
    Ask in comp.programming.threads
    Google and otherwise research mutexes and other such locking mechanisms.
     
    Jim Langston, Sep 1, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman
    Replies:
    1
    Views:
    1,372
    smith
    Dec 8, 2004
  2. SpamProof
    Replies:
    0
    Views:
    581
    SpamProof
    Oct 21, 2003
  3. avnrao
    Replies:
    0
    Views:
    3,368
    avnrao
    May 7, 2004
  4. Darrel
    Replies:
    2
    Views:
    1,179
    Darrel
    May 17, 2006
  5. liu yang
    Replies:
    4
    Views:
    2,011
    Antoninus Twink
    Jul 28, 2008
Loading...

Share This Page