Re: "RuntimeError: dictionary changed size during iteration" ;Good atomic copy operations?

Discussion in 'Python' started by Jean-Paul Calderone, Mar 13, 2006.

  1. On 12 Mar 2006 17:56:37 -0800, Raymond Hettinger <> wrote:
    >
    >Thinking about future directions for Python threading, I wonder if
    >there is a way to expose the GIL (or simply impose a temporary
    >moratorium on thread switches) so that it becomes easy to introduce
    >atomicity when needed:
    >
    > gil.acquire(BLOCK=True)
    > try:
    > #do some transaction that needs to be atomic
    > finally:
    > gil.release()
    >


    This is vaguely possible using sys.setcheckinterval() now, although one has to pick a ridiculously large number and hope that the atomic operation takes fewer than that many opcodes.

    Spelling "do not switch threads" as sys.setcheckinterval(None) seems somewhat natural, though. Perhaps that would be a fruitful direction to explore.

    Jean-Paul
    Jean-Paul Calderone, Mar 13, 2006
    #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. Roman Suzi
    Replies:
    0
    Views:
    324
    Roman Suzi
    Jan 19, 2005
  2. Terry Reedy
    Replies:
    0
    Views:
    354
    Terry Reedy
    Jan 20, 2005
  3. robert
    Replies:
    29
    Views:
    1,042
    Raymond Hettinger
    Mar 14, 2006
  4. Robert Dailey
    Replies:
    6
    Views:
    374
    Terry Reedy
    Dec 9, 2008
  5. Charles Oliver Nutter

    [ANN] atomic 0.0.1 - An atomic reference for Ruby

    Charles Oliver Nutter, Jun 8, 2010, in forum: Ruby
    Replies:
    5
    Views:
    215
    Robert Dober
    Jun 8, 2010
Loading...

Share This Page