static function vs. multithreaded app.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SLEEPY LOLO

    static function vs. multithreaded app.

    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


  • Adie

    #2
    Re: static function vs. multithreaded app.

    Victor Bazarov wrote:[color=blue]
    >"SLEEPY LOLO" <a@aaa.com> wrote...[color=green]
    >>
    >> I have static function and three threads. I would like every thread to use
    >> this function at the same time. Is it possible?[/color]
    >
    >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.programmin g.threads.[/color]

    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

    Comment

    • Alexander Terekhov

      #3
      Re: static function vs. multithreaded app.


      SLEEPY LOLO wrote:[color=blue]
      >
      > Hi!
      >
      > I have static function and three threads. I would like every thread to use
      > this function at the same time. Is it possible?[/color]

      Only if you have "Windows 2000 Server" (4-CPU limit).
      [color=blue]
      > I'm using VC++ under Windows2000.[/color]

      Condolence.

      regards,
      alexander.

      Comment

      • Sin

        #4
        Re: static function vs. multithreaded app.

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


        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.


        Comment

        Working...