[Python-ideas] Protecting finally clauses of interruptions

Yury Selivanov yselivanov.ml at gmail.com
Mon Apr 2 23:26:40 CEST 2012


On 2012-04-02, at 4:49 PM, Paul Colomiets wrote:
> l.lock()
> try:
>    ...
> finally:
>    l.unlock()
> 
> Which will break if you interrupted just after lock is acquired.

I guess the best way to solve this puzzle, is to track all locks that
the thread acquires and release them in case of forced interruption.

-
Yury



More information about the Python-ideas mailing list