/kolab/bin/python: double free or corruption (fasttop)

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Dec 29 01:12:02 EST 2008


En Sun, 28 Dec 2008 12:10:06 -0200, aspineux <aspineux at gmail.com> escribió:

> I got this.
> This is a test script, to help me to understand why I have unexpected
> result in application.
> But I got a more unexpected result, and probably wrong error message
> about the read-only cursor.

> def server():
>     dbenv, db=init_db(read_only=False)
>
>     update_thread=threading.Thread(target=lambda : cleanup(db))
>     update_thread.setDaemon(True)
>     update_thread.start()

I'd write it as
update_thread = threading.Thread(target=cleanup, args=(db,))
or:
update_thread = threading.Thread(target=lambda db=db: cleanup(db))

The original code is creating a closure and I'm unsure how closures  
interact with threads.

-- 
Gabriel Genellina




More information about the Python-list mailing list