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. Advertisements

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. Neil Zanella
    Replies:
    8
    Views:
    1,435
    mfmehdi
    Oct 20, 2006
  2. =?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:
    19,441
  3. Harry George
    Replies:
    6
    Views:
    639
    Bart Nessux
    Feb 23, 2004
  4. Replies:
    5
    Views:
    824
    Chris Thomasson
    Aug 23, 2007
  5. Olumide
    Replies:
    6
    Views:
    741
    Ian Collins
    Oct 23, 2007
  6. Vince
    Replies:
    12
    Views:
    944
    Martin Gregorie
    Jan 21, 2008
  7. Hicham Mouline
    Replies:
    5
    Views:
    2,714
    James Kanze
    Dec 19, 2008
  8. John Crichton
    Replies:
    6
    Views:
    435
    John Crichton
    Jul 12, 2010
Loading...