static statements and thread safety

Discussion in 'Python' started by Eric Snow, Sep 22, 2011.

  1. Eric Snow

    Eric Snow Guest

    A recent thread on the python-ideas list got me thinking about the
    possibility of a static statement (akin to global and nonlocal). I am
    wondering if an implementation would have to address thread safety
    concerns.

    I would expect that static variables would work pretty much the same
    way as default arguments, with a list of names on the code object and
    a list of values on the function object. And I would guess that the
    values from the static variables would get updated on the function
    object at the end of the call. If multiple threads are executing the
    function at the same time won't there be a problem with that
    end-of-call update?

    -eric


    p.s. It probably shows that I haven't done a lot of thread-related
    programming, so perhaps this is not a hard question.
     
    Eric Snow, Sep 22, 2011
    #1
    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. =?Utf-8?B?V2ViTWF0cml4?=

    Static Functions and Thread Safety. How does it work?

    =?Utf-8?B?V2ViTWF0cml4?=, Mar 24, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    16,681
  2. Replies:
    5
    Views:
    657
    Chris Thomasson
    Aug 23, 2007
  3. Olumide
    Replies:
    6
    Views:
    609
    Ian Collins
    Oct 23, 2007
  4. Hicham Mouline
    Replies:
    5
    Views:
    2,461
    James Kanze
    Dec 19, 2008
  5. John Crichton
    Replies:
    6
    Views:
    292
    John Crichton
    Jul 12, 2010
Loading...

Share This Page