static function vs. multithreaded app.

Discussion in 'C++' started by SLEEPY LOLO, Jun 25, 2003.

  1. SLEEPY LOLO

    SLEEPY LOLO Guest

    Hi!

    I have static function and three threads. I would like every thread to use
    this function at the same time. Is it possible?
    I'm using VC++ under Windows2000.

    Thanks

    Hubert
    SLEEPY LOLO, Jun 25, 2003
    #1
    1. Advertising

  2. SLEEPY LOLO

    Sin Guest

    > I have static function and three threads. I would like every thread to use
    > this function at the same time. Is it possible?
    > I'm using VC++ under Windows2000.



    This is off-topic here... Try a Microsoft newsgroup.

    As for the answer to you question, it's ambigous. A static function is not
    different from a normal function (the static keyword doesn't behave the same
    way with functions and variables), but a normal function still needs to be
    programmed in a way that makes it thread safe.

    If for example the function contains static variables, uses global
    variables, non-thread-safe functions, etc, you must use synchronization to
    avoid problems.

    Alex.
    Sin, Jun 25, 2003
    #2
    1. Advertising

  3. SLEEPY LOLO

    Adie Guest

    Victor Bazarov wrote:
    >"SLEEPY LOLO" <> wrote...
    >>
    >> I have static function and three threads. I would like every thread to use
    >> this function at the same time. Is it possible?

    >
    >Sure it's possible.
    >
    >What you should be concerned with is _data_, not _code_.
    >I think you need a decent book on multithreading to get you
    >up to speed on concepts like synchronisation, blocking, race
    >conditions, etc. All of those have really nothing to do with
    >C++ as a language (the language doesn't have any special
    >support for multithreading). You probably want to ask in
    >a newsgroup for your OS or in comp.programming.threads.


    Is it just me (who's had a glass or two of wine) or is Victor writing like
    he's just burnt the fattest cone this side of Jamaica?

    Mellow v i c t o r
    Adie, Jun 25, 2003
    #3
  4. SLEEPY LOLO wrote:
    >
    > Hi!
    >
    > I have static function and three threads. I would like every thread to use
    > this function at the same time. Is it possible?


    Only if you have "Windows 2000 Server" (4-CPU limit).

    > I'm using VC++ under Windows2000.


    Condolence.

    regards,
    alexander.
    Alexander Terekhov, Jun 25, 2003
    #4
    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. Pavils Jurjans
    Replies:
    7
    Views:
    541
    John Saunders
    Jun 2, 2004
  2. Replies:
    1
    Views:
    412
    Pete Becker
    Feb 2, 2005
  3. Replies:
    1
    Views:
    691
    E. Robert Tisdale
    Feb 23, 2005
  4. notanotheridiot
    Replies:
    1
    Views:
    419
    Antoon Pardon
    Jul 14, 2006
  5. Replies:
    3
    Views:
    312
    Martin Steen
    Sep 28, 2006
Loading...

Share This Page