locked
Thread calling static function RRS feed

  • Question

  • In the thread, if I just call a regular static function of a class(without accessing any blobals), will that static function be considered as thread safe?

    And if the same static function gets called by different threads at the same time, it will be put in different call stacks, is that correct? Thanks.

    WJ

    Friday, June 25, 2010 3:21 PM

All replies

  • >In the thread, if I just call a regular static function of a class(without accessing any blobals), will that static function be considered as thread safe?

    There's no problem with calling the function from multiple threads, it
    depends what the function does.

    If it manipulates static data of the class (i.e. the data is
    effectively global), or other global variables, then you may have an
    issue - you need to look further into what it does to decide if there
    is a problem or not.

    Dave

    Friday, June 25, 2010 3:35 PM